3 Commits

Author SHA1 Message Date
DatCaptainHorse
0475dd5766 fix(relay): Specify IP as Host rather than srflx 2025-11-29 19:05:20 +02:00
DatCaptainHorse
a318876eb3 fix(relay): Use built-in method for checking private IP 2025-11-29 19:01:12 +02:00
DatCaptainHorse
f20f01e6d6 fix(relay): Ignore potential private/internal IPs 2025-11-29 18:53:13 +02:00
2 changed files with 2 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ func InitWebRTCAPI() error {
nat11IP := GetFlags().NAT11IP
if len(nat11IP) > 0 {
settingEngine.SetNAT1To1IPs([]string{nat11IP}, webrtc.ICECandidateTypeSrflx)
settingEngine.SetNAT1To1IPs([]string{nat11IP}, webrtc.ICECandidateTypeHost)
slog.Info("Using NAT 1:1 IP for WebRTC", "nat11_ip", nat11IP)
}

View File

@@ -125,7 +125,7 @@ func getLocalIP() string {
return ""
}
for _, address := range addrs {
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() && !ipnet.IP.IsPrivate() && !ipnet.IP.IsUnspecified() {
if ipnet.IP.To4() != nil || ipnet.IP != nil {
return ipnet.IP.String()
}