From ae034a7330f456ee9cc63c8ec295140ebe510e2c Mon Sep 17 00:00:00 2001 From: "Theodor S. Midtlien" Date: Fri, 15 May 2026 17:10:54 +0200 Subject: [PATCH] Allow wireguard port to be set to 0 in UI --- client/ui/client_ui.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ui/client_ui.go b/client/ui/client_ui.go index c2129c7a2..9c8bcab83 100644 --- a/client/ui/client_ui.go +++ b/client/ui/client_ui.go @@ -502,7 +502,7 @@ func (s *serviceClient) getConnectionForm() *widget.Form { {Text: "Pre-shared Key", Widget: s.iPreSharedKey}, {Text: "Quantum-Resistance", Widget: s.sRosenpassPermissive}, {Text: "Interface Name", Widget: s.iInterfaceName}, - {Text: "Interface Port", Widget: s.iInterfacePort}, + {Text: "Interface Port", Widget: s.iInterfacePort, HintText: "If set to 0, a random free port will be used"}, {Text: "MTU", Widget: s.iMTU}, {Text: "Log File", Widget: s.iLogFile}, }, @@ -558,7 +558,7 @@ func (s *serviceClient) parseNumericSettings() (int64, int64, error) { if err != nil { return 0, 0, errors.New("invalid interface port") } - if port < 1 || port > 65535 { + if port < 0 || port > 65535 { return 0, 0, errors.New("invalid interface port: out of range 1-65535") } @@ -1438,7 +1438,7 @@ func protoConfigToConfig(cfg *proto.GetConfigResponse) *profilemanager.Config { } config.WgIface = cfg.InterfaceName - if cfg.WireguardPort != 0 { + if cfg.WireguardPort >= 0 && cfg.WireguardPort <= 65535 { config.WgPort = int(cfg.WireguardPort) } else { config.WgPort = iface.DefaultWgPort