These examples demonstrate how to use ship-go to implement SHIP protocol devices. For complete SHIP protocol details, refer to the specification at https://www.eebus.org.
1. quickstart - Minimal SHIP Hub
The simplest possible SHIP hub implementation that:
- Creates a SHIP-compliant certificate (Section 12)
- Starts mDNS service discovery (Section 5)
- Accepts incoming SHIP connections (Section 13.4)
- Auto-accepts pairing for demo purposes
Run it:
cd quickstart
go run main.go- client/ - Connect to another SHIP device
- pairing/ - Implement proper user verification for pairing
- production/ - Production-ready hub with error handling and persistence
Each example includes comments referencing relevant SHIP specification sections:
// Start mDNS discovery (SHIP Section 5)
mdns.Start()
// Begin handshake (SHIP Section 13.4.4)
connection.StartHandshake()These examples use auto-accept pairing for simplicity. Never use auto-accept in production! See SECURITY.md for proper security implementation.
- Go 1.19 or later
- Linux with Avahi daemon (recommended) or any OS for Zeroconf fallback
- Network that supports mDNS (most local networks)
If examples don't work:
- Check mDNS: Ensure your network allows multicast traffic
- Firewall: Port 4712 must be accessible
- Avahi: On Linux, ensure
avahi-daemonis running - Logs: Set
SHIP_LOG=debugfor detailed logging