chore(settings): refactor settings processing (#756)
- 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)
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"math/rand"
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration"
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
@@ -17,15 +17,15 @@ import (
|
||||
// Otherwise, it picks a random connection from the pool of connections
|
||||
// and sets the target IP address as the IP if this one is set.
|
||||
func PickConnection(connections []models.Connection,
|
||||
selection configuration.ServerSelection, randSource rand.Source) (
|
||||
selection settings.ServerSelection, randSource rand.Source) (
|
||||
connection models.Connection, err error) {
|
||||
if selection.TargetIP != nil && selection.VPN == constants.Wireguard {
|
||||
if len(selection.TargetIP) > 0 && selection.VPN == constants.Wireguard {
|
||||
// we need the right public key
|
||||
return getTargetIPConnection(connections, selection.TargetIP)
|
||||
}
|
||||
|
||||
connection = pickRandomConnection(connections, randSource)
|
||||
if selection.TargetIP != nil {
|
||||
if len(selection.TargetIP) > 0 {
|
||||
connection.IP = selection.TargetIP
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user