From 57542a3d80fa9ef1896cf2fc2080d0ea6d279cbc Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Sun, 10 May 2026 14:01:40 -0400 Subject: [PATCH] webrtc: add NAT1To1IPs []string to Config for multi-IP support (issue #20) --- core/webrtc/config.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/webrtc/config.go b/core/webrtc/config.go index 521e009..8a0f24f 100644 --- a/core/webrtc/config.go +++ b/core/webrtc/config.go @@ -17,8 +17,18 @@ type Config struct { // PublicIP is the server's externally-reachable IP, advertised in ICE // candidates via NAT1To1. Empty means rely on STUN discovery. + // Deprecated in favour of NAT1To1IPs for multi-homed servers; when both + // are set, PublicIP is treated as the first entry in NAT1To1IPs. PublicIP string + // NAT1To1IPs is the list of NAT1To1 IPs for ICE host candidates. + // When non-empty, Pion advertises a host candidate for each IP so that + // peers can reach this server through NAT on any of the listed addresses. + // Takes precedence over PublicIP when set; PublicIP is treated as a member + // of this list when both are configured. Typical use: dual-homed servers + // with both a LAN IP and a public IP. + NAT1To1IPs []string + // UDPPortRange bounds the local UDP ports allocated for FFmpeg→Pion RTP. UDPPortRange PortRange @@ -35,6 +45,7 @@ func DefaultConfig() Config { Enabled: true, WHEPListen: ":8787", PublicIP: "", + NAT1To1IPs: nil, UDPPortRange: PortRange{Low: 10000, High: 10100}, ICEServers: []string{"stun:stun.cloudflare.com:3478", "stun:stun.l.google.com:19302"}, MaxPeersTotal: 32,