mirror of
https://github.com/fosrl/olm.git
synced 2026-02-16 09:56:40 +00:00
Treat mtu as int and dont overwrite from websocket
This commit is contained in:
22
main.go
22
main.go
@@ -222,7 +222,6 @@ func runOlmMainWithArgs(ctx context.Context, args []string) {
|
||||
id = config.ID
|
||||
secret = config.Secret
|
||||
mtu = config.MTU
|
||||
mtuInt int
|
||||
logLevel = config.LogLevel
|
||||
interfaceName = config.InterfaceName
|
||||
enableHTTP = config.EnableHTTP
|
||||
@@ -324,15 +323,6 @@ func runOlmMainWithArgs(ctx context.Context, args []string) {
|
||||
if err != nil {
|
||||
logger.Fatal("Failed to create olm: %v", err)
|
||||
}
|
||||
// Update config with values from websocket client (which may have loaded from its config file)
|
||||
config.UpdateFromWebsocket(
|
||||
olm.GetConfig().ID,
|
||||
olm.GetConfig().Secret,
|
||||
olm.GetConfig().Endpoint,
|
||||
)
|
||||
endpoint = config.Endpoint
|
||||
id = config.ID
|
||||
secret = config.Secret
|
||||
|
||||
// wait until we have a client id and secret and endpoint
|
||||
waitCount := 0
|
||||
@@ -360,12 +350,6 @@ func runOlmMainWithArgs(ctx context.Context, args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
// parse the mtu string into an int
|
||||
mtuInt, err = strconv.Atoi(mtu)
|
||||
if err != nil {
|
||||
logger.Fatal("Failed to parse MTU: %v", err)
|
||||
}
|
||||
|
||||
privateKey, err = wgtypes.GeneratePrivateKey()
|
||||
if err != nil {
|
||||
logger.Fatal("Failed to generate private key: %v", err)
|
||||
@@ -486,12 +470,12 @@ func runOlmMainWithArgs(ctx context.Context, args []string) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tun.CreateTUN(interfaceName, mtuInt)
|
||||
return tun.CreateTUN(interfaceName, mtu)
|
||||
}
|
||||
if tunFdStr := os.Getenv(ENV_WG_TUN_FD); tunFdStr != "" {
|
||||
return createTUNFromFD(tunFdStr, mtuInt)
|
||||
return createTUNFromFD(tunFdStr, mtu)
|
||||
}
|
||||
return tun.CreateTUN(interfaceName, mtuInt)
|
||||
return tun.CreateTUN(interfaceName, mtu)
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user