mirror of
https://github.com/fosrl/newt.git
synced 2026-03-08 03:36:40 +00:00
Fix --port
This commit is contained in:
@@ -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)
|
return nil, fmt.Errorf("failed to generate private key: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Debug("+++++++++++++++++++++++++++++++= the port is %d", port)
|
||||||
|
|
||||||
if port == 0 {
|
if port == 0 {
|
||||||
// Find an available port
|
// Find an available port
|
||||||
portRandom, err := util.FindAvailableUDPPort(49152, 65535)
|
portRandom, err := util.FindAvailableUDPPort(49152, 65535)
|
||||||
|
|||||||
20
main.go
20
main.go
@@ -347,15 +347,6 @@ func runNewtMain(ctx context.Context) {
|
|||||||
pingTimeout = 5 * time.Second
|
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 == "" {
|
if dockerEnforceNetworkValidation == "" {
|
||||||
flag.StringVar(&dockerEnforceNetworkValidation, "docker-enforce-network-validation", "false", "Enforce validation of container on newt network (true or false)")
|
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...)
|
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 {
|
if *version {
|
||||||
fmt.Println("Newt version " + newtVersion)
|
fmt.Println("Newt version " + newtVersion)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
@@ -618,6 +618,8 @@ func runNewtMain(ctx context.Context) {
|
|||||||
var connected bool
|
var connected bool
|
||||||
var wgData WgData
|
var wgData WgData
|
||||||
var dockerEventMonitor *docker.EventMonitor
|
var dockerEventMonitor *docker.EventMonitor
|
||||||
|
|
||||||
|
logger.Debug("++++++++++++++++++++++ the port is %d", port)
|
||||||
|
|
||||||
if !disableClients {
|
if !disableClients {
|
||||||
setupClients(client)
|
setupClients(client)
|
||||||
|
|||||||
Reference in New Issue
Block a user