webrtc: add NAT1To1IPs []string to Config for multi-IP support (issue #20)
Some checks failed
ci / race tests (push) Blocked by required conditions
ci / WebRTC smoke (5-viewer fanout) (push) Blocked by required conditions
ci / WebRTC latency p95 gate (push) Blocked by required conditions
ci / vet + build (push) Has been cancelled

This commit is contained in:
Zac Gaetano 2026-05-10 14:01:40 -04:00
parent 10eaaff6b7
commit 57542a3d80

View file

@ -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,