diff --git a/clients/clients.go b/clients/clients.go index b7065fa..ddece12 100644 --- a/clients/clients.go +++ b/clients/clients.go @@ -112,6 +112,8 @@ func NewWireGuardService(interfaceName string, port uint16, mtu int, host string return nil, fmt.Errorf("failed to generate private key: %v", err) } + logger.Debug("+++++++++++++++++++++++++++++++= the port is %d", port) + if port == 0 { // Find an available port portRandom, err := util.FindAvailableUDPPort(49152, 65535) diff --git a/main.go b/main.go index dee958a..9c373b0 100644 --- a/main.go +++ b/main.go @@ -347,15 +347,6 @@ func runNewtMain(ctx context.Context) { pingTimeout = 5 * time.Second } - if portStr != "" { - portInt, err := strconv.Atoi(portStr) - if err != nil { - logger.Warn("Failed to parse PORT, choosing a random port") - } else { - port = uint16(portInt) - } - } - if dockerEnforceNetworkValidation == "" { flag.StringVar(&dockerEnforceNetworkValidation, "docker-enforce-network-validation", "false", "Enforce validation of container on newt network (true or false)") } @@ -441,6 +432,15 @@ func runNewtMain(ctx context.Context) { tlsClientCAs = append(tlsClientCAs, tlsClientCAsFlag...) } + if portStr != "" { + portInt, err := strconv.Atoi(portStr) + if err != nil { + logger.Warn("Failed to parse PORT, choosing a random port") + } else { + port = uint16(portInt) + } + } + if *version { fmt.Println("Newt version " + newtVersion) os.Exit(0) @@ -618,6 +618,8 @@ func runNewtMain(ctx context.Context) { var connected bool var wgData WgData var dockerEventMonitor *docker.EventMonitor + + logger.Debug("++++++++++++++++++++++ the port is %d", port) if !disableClients { setupClients(client)