feat: emit peer_status (ICE state + candidate type) from daemon

Hooks pc.OnConnectionStateChange in WireDataChannel to emit peer_status
events. On connected, calls pc.GetStats() to find the nominated candidate
pair and report candidateType (host/srflx/relay) and remote address.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-25 19:28:27 +02:00
parent bb53357bc8
commit 6e8c8180b5
2 changed files with 53 additions and 0 deletions

View File

@@ -228,6 +228,7 @@ const (
EvtPeerConnected IpcMsgType = "peer_connected"
EvtPeerDisconnected IpcMsgType = "peer_disconnected"
EvtSessionReady IpcMsgType = "session_ready" // DataChannel open + hello verified
EvtPeerStatus IpcMsgType = "peer_status" // ICE connection state + candidate type
EvtIncomingFile IpcMsgType = "incoming_file"
EvtFileProgress IpcMsgType = "file_progress"
EvtStateSnapshot IpcMsgType = "state_snapshot"
@@ -294,4 +295,8 @@ type IpcMessage struct {
// export_identity / import_identity
Passphrase string `json:"passphrase,omitempty"` // import only; never echoed back
Backup string `json:"backup,omitempty"` // JSON backup blob
// peer_status — ICE connection quality
ConnState string `json:"conn_state,omitempty"` // pion PeerConnectionState string
CandidateType string `json:"candidate_type,omitempty"` // host | srflx | relay | unknown
RemoteAddress string `json:"remote_address,omitempty"` // remote IP:port of active candidate pair
}