fix(wireguard): WIREGUARD_ENDPOINT_IP overrides the IP address of a picked connection

- Regression introduced in v3.39.0
- Fix #2759
This commit is contained in:
Quentin McGaw
2025-11-19 13:11:00 +00:00
parent 5ff5fc4a5e
commit 31284542a2
5 changed files with 44 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/vpn"
)
func commaJoin(slice []string) string {
@@ -148,9 +149,13 @@ func noServerFoundError(selection settings.ServerSelection) (err error) {
messageParts = append(messageParts, "tor only")
}
if selection.TargetIP.IsValid() {
targetIP := selection.OpenVPN.EndpointIP
if selection.VPN == vpn.Wireguard {
targetIP = selection.Wireguard.EndpointIP
}
if targetIP.IsValid() {
messageParts = append(messageParts,
"target ip address "+selection.TargetIP.String())
"target ip address "+targetIP.String())
}
message := "for " + strings.Join(messageParts, "; ")