- Better settings tree structure logged using `qdm12/gotree` - Read settings from environment variables, then files, then secret files - Settings methods to default them, merge them and override them - `DNS_PLAINTEXT_ADDRESS` default changed to `127.0.0.1` to use DoT. Warning added if set to something else. - `HTTPPROXY_LISTENING_ADDRESS` instead of `HTTPPROXY_PORT` (with retro-compatibility)
37 lines
882 B
Go
37 lines
882 B
Go
package nordvpn
|
|
|
|
import (
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
|
)
|
|
|
|
func (n *Nordvpn) GetConnection(selection settings.ServerSelection) (
|
|
connection models.Connection, err error) {
|
|
var port uint16 = 1194
|
|
protocol := constants.UDP
|
|
if *selection.OpenVPN.TCP {
|
|
port = 443
|
|
protocol = constants.TCP
|
|
}
|
|
|
|
servers, err := n.filterServers(selection)
|
|
if err != nil {
|
|
return connection, err
|
|
}
|
|
|
|
connections := make([]models.Connection, len(servers))
|
|
for i := range servers {
|
|
connection := models.Connection{
|
|
Type: selection.VPN,
|
|
IP: servers[i].IP,
|
|
Port: port,
|
|
Protocol: protocol,
|
|
}
|
|
connections[i] = connection
|
|
}
|
|
|
|
return utils.PickConnection(connections, selection, n.randSource)
|
|
}
|