Merge remote-tracking branch 'gitlab/mr/107'

This commit is contained in:
meskio 2022-10-17 12:36:19 +02:00
commit ac8562803a
No known key found for this signature in database
GPG key ID: 52B8F5AC97A2DA86
2 changed files with 15 additions and 6 deletions

View file

@ -354,7 +354,10 @@ func (sf *SnowflakeProxy) makeWebRTCAPI() *webrtc.API {
settingsEngine := webrtc.SettingEngine{} settingsEngine := webrtc.SettingEngine{}
if sf.EphemeralMinPort != 0 && sf.EphemeralMaxPort != 0 { if sf.EphemeralMinPort != 0 && sf.EphemeralMaxPort != 0 {
settingsEngine.SetEphemeralUDPPortRange(sf.EphemeralMinPort, sf.EphemeralMaxPort) err := settingsEngine.SetEphemeralUDPPortRange(sf.EphemeralMinPort, sf.EphemeralMaxPort)
if err != nil {
log.Fatal("Invalid port range: min > max")
}
} }
settingsEngine.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled) settingsEngine.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)

View file

@ -2,7 +2,6 @@ package main
import ( import (
"flag" "flag"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
@ -31,7 +30,7 @@ func main() {
SummaryInterval := flag.Duration("summary-interval", time.Hour, SummaryInterval := flag.Duration("summary-interval", time.Hour,
"the time interval to output summary, 0s disables summaries. Valid time units are \"s\", \"m\", \"h\". ") "the time interval to output summary, 0s disables summaries. Valid time units are \"s\", \"m\", \"h\". ")
verboseLogging := flag.Bool("verbose", false, "increase log verbosity") verboseLogging := flag.Bool("verbose", false, "increase log verbosity")
ephemeralPortsRangeFlag := flag.String("ephemeral-ports-range", "ICE UDP ephemeral ports range (format:\"[min]:[max]\")", "") ephemeralPortsRangeFlag := flag.String("ephemeral-ports-range", "", "ICE UDP ephemeral ports range (format:\"<min>:<max>\")")
var ephemeralPortsRange []uint16 = []uint16{0, 0} var ephemeralPortsRange []uint16 = []uint16{0, 0}
@ -52,10 +51,17 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
ephemeralPortsRange = []uint16{uint16(ephemeralMinPort), uint16(ephemeralMaxPort)} if ephemeralMinPort == 0 || ephemeralMaxPort == 0 {
} log.Fatal("Ephemeral port cannot be zero")
}
if ephemeralMinPort > ephemeralMaxPort {
log.Fatal("Invalid port range: min > max")
}
fmt.Printf("Bad range port format: %v", ephemeralPortsRangeFlag) ephemeralPortsRange = []uint16{uint16(ephemeralMinPort), uint16(ephemeralMaxPort)}
} else {
log.Fatalf("Bad range port format: %v", *ephemeralPortsRangeFlag)
}
} }
proxy := sf.SnowflakeProxy{ proxy := sf.SnowflakeProxy{