examples/

directory
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT

README

ship-go Examples

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.

Examples

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
Coming Soon
  • client/ - Connect to another SHIP device
  • pairing/ - Implement proper user verification for pairing
  • production/ - Production-ready hub with error handling and persistence

Key Concepts

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()

Security Note

These examples use auto-accept pairing for simplicity. Never use auto-accept in production! See SECURITY.md for proper security implementation.

Prerequisites

  • Go 1.19 or later
  • Linux with Avahi daemon (recommended) or any OS for Zeroconf fallback
  • Network that supports mDNS (most local networks)

Troubleshooting

If examples don't work:

  1. Check mDNS: Ensure your network allows multicast traffic
  2. Firewall: Port 4712 must be accessible
  3. Avahi: On Linux, ensure avahi-daemon is running
  4. Logs: Set SHIP_LOG=debug for detailed logging

Learn More

Directories

Path Synopsis
Package main demonstrates a SHIP client that connects to other SHIP devices.
Package main demonstrates a SHIP client that connects to other SHIP devices.
Package main demonstrates different SHIP pairing workflows and trust establishment.
Package main demonstrates different SHIP pairing workflows and trust establishment.
Package main demonstrates a SHIP pairing announcer that parses QR codes and announces pairing.
Package main demonstrates a SHIP pairing announcer that parses QR codes and announces pairing.
Package main demonstrates a SHIP pairing listener that generates QR codes for device pairing.
Package main demonstrates a SHIP pairing listener that generates QR codes for device pairing.
Package main demonstrates a production-ready SHIP hub implementation.
Package main demonstrates a production-ready SHIP hub implementation.
Package main demonstrates a minimal SHIP hub implementation.
Package main demonstrates a minimal SHIP hub implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL