Add TURN relay support for daemon mode

-turn-url and -turn-secret flags on the daemon; credentials generated
using coturn use-auth-secret HMAC-SHA1 scheme (same as browser mode).
ICEServers field on mesh.Mesh threads extra ICE servers through to
every PeerConnection created by the anchor client.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-26 22:16:18 +02:00
parent 31e13fd509
commit 1308082c7b
4 changed files with 50 additions and 8 deletions

View File

@@ -22,6 +22,8 @@ func main() {
anchorURL := flag.String("anchor", "", "anchor WebSocket URL, e.g. ws://your-vps:17339/ws")
shareDir := flag.String("share-dir", "", "directory to share with peers on the network")
joinInvite := flag.String("join", "", "waste: invite string — sets anchor URL and auto-joins the network on startup")
turnURL := flag.String("turn-url", "", "TURN server URL, e.g. turn:your-vps:3478")
turnSecret := flag.String("turn-secret", "", "shared secret for coturn use-auth-secret HMAC credential")
importBackup := flag.String("import-identity", "", "path to a yaw-key-backup-1 JSON file to import")
importPassword := flag.String("import-passphrase", "", "passphrase for --import-identity")
flag.Parse()
@@ -74,6 +76,8 @@ func main() {
StoreDir: dir,
AnchorURL: *anchorURL,
ShareDir: expandHome(*shareDir),
TurnURL: *turnURL,
TurnSecret: *turnSecret,
})
if autoJoinNetwork != "" {