fix(configuration/sources/files/wireguard): fix parsing ipv6 endpoint port

This commit is contained in:
Quentin McGaw
2026-05-05 21:28:08 +00:00
parent 4ea2337668
commit 12f08bf5ad
2 changed files with 3 additions and 6 deletions
@@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"regexp"
"strings"
"gopkg.in/ini.v1"
)
@@ -84,10 +83,7 @@ func parseWireguardPeerSection(peerSection *ini.Section) (
host, port, err := net.SplitHostPort(*endpoint)
if err == nil {
endpointIP = &host
// IPv6 hosts contain colons; port is managed by the provider for those
if !strings.Contains(host, ":") {
endpointPort = &port
}
endpointPort = &port
} else {
endpointIP = endpoint
}
@@ -182,7 +182,8 @@ Endpoint = 1.2.3.4:51820`,
"ipv6_endpoint": {
iniData: `[Peer]
Endpoint = [2a02:bbbb:aaaa:8075::10]:51820`,
endpointIP: ptrTo("2a02:bbbb:aaaa:8075::10"),
endpointIP: ptrTo("2a02:bbbb:aaaa:8075::10"),
endpointPort: ptrTo("51820"),
},
}