initial code

This commit is contained in:
Quentin McGaw
2024-10-23 09:05:32 +00:00
parent 7f9cd0fd0c
commit 6199fdc853
30 changed files with 934 additions and 23 deletions
+10 -1
View File
@@ -14,7 +14,7 @@ func commaJoin(slice []string) string {
return strings.Join(slice, ", ")
}
func noServerFoundError(selection settings.ServerSelection) (err error) {
func noServerFoundError(selection settings.ServerSelection) (err error) { //nolint:gocyclo
var messageParts []string
messageParts = append(messageParts, "VPN "+selection.VPN)
@@ -155,6 +155,15 @@ func noServerFoundError(selection settings.ServerSelection) (err error) {
"target ip address "+targetIP.String())
}
customPort := *selection.OpenVPN.CustomPort
if selection.VPN == vpn.Wireguard {
customPort = *selection.Wireguard.EndpointPort
}
if customPort > 0 {
messageParts = append(messageParts,
fmt.Sprintf("%s endpoint port %d", selection.VPN, customPort))
}
message := "for " + strings.Join(messageParts, "; ")
return fmt.Errorf("no server found: %s", message)