From 8fc0695e4f218a7ef09fbaa369456be50bcbb645 Mon Sep 17 00:00:00 2001 From: gongluck Date: Thu, 25 Jul 2024 11:54:18 +0800 Subject: [PATCH] Fix `is-server` being ignored in stun-multiplex Call `flag.Parse()` first to enable normal reading of parameters --- cmd/stun-multiplex/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/stun-multiplex/main.go b/cmd/stun-multiplex/main.go index 7e281c8..1212235 100644 --- a/cmd/stun-multiplex/main.go +++ b/cmd/stun-multiplex/main.go @@ -85,10 +85,10 @@ func multiplex(conn *net.UDPConn, stunAddr net.Addr, stunConn io.Reader) { var stunServer = flag.String("stun", "stun.l.google.com:19302", "STUN Server to use") //nolint:gochecknoglobals func main() { - isServer := flag.Arg(0) == "" - flag.Parse() + isServer := flag.Arg(0) == "" + // Allocating local UDP socket that will be used both for STUN and // our application data. addr, err := net.ResolveUDPAddr("udp4", "0.0.0.0:0")