Use -udp-range for both range and multiplexing.
This commit is contained in:
@@ -2,7 +2,7 @@ Galene 0.97 (unreleased)
|
||||
|
||||
* Upgrade to Pion v4.
|
||||
* Add support for ETags and ICE restarts to the WHIP server.
|
||||
* Implement UDP multiplexing and the option "-udp".
|
||||
* Implement UDP multiplexing.
|
||||
|
||||
8 March 2025: Galene 0.96.3
|
||||
|
||||
|
||||
@@ -74,15 +74,15 @@ traffic to and from:
|
||||
|
||||
For good performance, your firewall should allow incoming and outgoing
|
||||
traffic from the UDP ports used for media transfer. By default, these are
|
||||
all high-numbered (ephemeral) ports, but they can be restricted using the
|
||||
following options:
|
||||
all high-numbered (ephemeral) ports, but they can be restricted using one
|
||||
of the following options:
|
||||
|
||||
* the `-udp-range port1-port2` option restricts the UDP ports to be in
|
||||
the range from port1 to port2 inclusive; this should be a large range,
|
||||
on the order of a few tens of thousands of ports;
|
||||
|
||||
* the `-udp port` option makes the server use just a single port, and
|
||||
demultiplex the traffic in userspace.
|
||||
* the `-udp-range port` option makes the server use just a single port,
|
||||
and demultiplex the traffic in userspace.
|
||||
|
||||
If your server is behind NAT (which is not recommended), then the NAT must
|
||||
forward, at the very least, port 8443 to your server. Ideally, you should
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -24,7 +25,7 @@ import (
|
||||
|
||||
func main() {
|
||||
var cpuprofile, memprofile, mutexprofile, httpAddr string
|
||||
var udp, udpRange string
|
||||
var udpRange string
|
||||
|
||||
flag.StringVar(&httpAddr, "http", ":8443", "web server `address`")
|
||||
flag.StringVar(&webserver.StaticRoot, "static", "./static/",
|
||||
@@ -43,8 +44,8 @@ func main() {
|
||||
"store memory profile in `file`")
|
||||
flag.StringVar(&mutexprofile, "mutexprofile", "",
|
||||
"store mutex profile in `file`")
|
||||
flag.StringVar(&udp, "udp", "", "UDP port")
|
||||
flag.StringVar(&udpRange, "udp-range", "", "UDP port `range`")
|
||||
flag.StringVar(&udpRange, "udp-range", "",
|
||||
"UDP `port` (multiplexing) or port1-port2 (range)")
|
||||
flag.BoolVar(&group.UseMDNS, "mdns", false, "gather mDNS addresses")
|
||||
flag.BoolVar(&ice.ICERelayOnly, "relay-only", false,
|
||||
"require use of TURN relays for all media traffic")
|
||||
@@ -52,29 +53,28 @@ func main() {
|
||||
"built-in TURN server `address` (\"\" to disable)")
|
||||
flag.Parse()
|
||||
|
||||
if udp != "" {
|
||||
if udpRange != "" {
|
||||
log.Fatalf("Cannot specify both -udp and -udp-range")
|
||||
if udpRange != "" {
|
||||
if strings.ContainsRune(udpRange, '-') {
|
||||
var min, max uint16
|
||||
n, err := fmt.Sscanf(udpRange, "%v-%v", &min, &max)
|
||||
if err != nil || n != 2 {
|
||||
log.Fatalf("UDP range: %v", err)
|
||||
}
|
||||
if n != 2 || min <= 0 || max <= 0 || min > max {
|
||||
log.Fatalf("UDP range: bad range")
|
||||
}
|
||||
group.UDPMin = min
|
||||
group.UDPMax = max
|
||||
} else {
|
||||
port, err := strconv.Atoi(udpRange)
|
||||
if err != nil {
|
||||
log.Fatalf("UDP: %v", err)
|
||||
}
|
||||
err = group.SetUDPMux(port)
|
||||
if err != nil {
|
||||
log.Fatalf("UDP: %v", err)
|
||||
}
|
||||
}
|
||||
port, err := strconv.Atoi(udp)
|
||||
if err != nil {
|
||||
log.Fatalf("UDP: %v", err)
|
||||
}
|
||||
err = group.SetUDPMux(port)
|
||||
if err != nil {
|
||||
log.Fatalf("UDP: %v", err)
|
||||
}
|
||||
} else if udpRange != "" {
|
||||
var min, max uint16
|
||||
n, err := fmt.Sscanf(udpRange, "%v-%v", &min, &max)
|
||||
if err != nil {
|
||||
log.Fatalf("UDP range: %v", err)
|
||||
}
|
||||
if n != 2 || min <= 0 || max <= 0 || min > max {
|
||||
log.Fatalf("UDP range: bad range")
|
||||
}
|
||||
group.UDPMin = min
|
||||
group.UDPMax = max
|
||||
}
|
||||
|
||||
if cpuprofile != "" {
|
||||
|
||||
Reference in New Issue
Block a user