mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
fix(configuration/sources/files/wireguard): fix parsing ipv6 endpoint port
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
)
|
)
|
||||||
@@ -84,10 +83,7 @@ func parseWireguardPeerSection(peerSection *ini.Section) (
|
|||||||
host, port, err := net.SplitHostPort(*endpoint)
|
host, port, err := net.SplitHostPort(*endpoint)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
endpointIP = &host
|
endpointIP = &host
|
||||||
// IPv6 hosts contain colons; port is managed by the provider for those
|
endpointPort = &port
|
||||||
if !strings.Contains(host, ":") {
|
|
||||||
endpointPort = &port
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
endpointIP = endpoint
|
endpointIP = endpoint
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,8 @@ Endpoint = 1.2.3.4:51820`,
|
|||||||
"ipv6_endpoint": {
|
"ipv6_endpoint": {
|
||||||
iniData: `[Peer]
|
iniData: `[Peer]
|
||||||
Endpoint = [2a02:bbbb:aaaa:8075::10]:51820`,
|
Endpoint = [2a02:bbbb:aaaa:8075::10]:51820`,
|
||||||
endpointIP: ptrTo("2a02:bbbb:aaaa:8075::10"),
|
endpointIP: ptrTo("2a02:bbbb:aaaa:8075::10"),
|
||||||
|
endpointPort: ptrTo("51820"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user