mirror of
https://github.com/fosrl/gerbil.git
synced 2026-03-07 11:16:40 +00:00
Working on mtu
This commit is contained in:
8
main.go
8
main.go
@@ -23,7 +23,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
interfaceName = "wg0"
|
interfaceName = "wg0"
|
||||||
listenAddr = ":3003"
|
listenAddr = ":3003"
|
||||||
mtu = 1420
|
mtuInt = 1420
|
||||||
lastReadings = make(map[string]PeerReading)
|
lastReadings = make(map[string]PeerReading)
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
)
|
)
|
||||||
@@ -79,7 +79,7 @@ func main() {
|
|||||||
|
|
||||||
// Define command line flags
|
// Define command line flags
|
||||||
interfaceNameArg := flag.String("interface", "wg0", "Name of the WireGuard interface")
|
interfaceNameArg := flag.String("interface", "wg0", "Name of the WireGuard interface")
|
||||||
mtuRead := flag.String("mtu", "1280", "MTU of the interface")
|
mtu := flag.String("mtu", "1280", "MTU of the interface")
|
||||||
configFile := flag.String("config", "", "Path to local configuration file")
|
configFile := flag.String("config", "", "Path to local configuration file")
|
||||||
remoteConfigURL := flag.String("remoteConfig", "", "URL to fetch remote configuration")
|
remoteConfigURL := flag.String("remoteConfig", "", "URL to fetch remote configuration")
|
||||||
listenAddrArg := flag.String("listen", ":3003", "Address to listen on")
|
listenAddrArg := flag.String("listen", ":3003", "Address to listen on")
|
||||||
@@ -100,7 +100,7 @@ func main() {
|
|||||||
listenAddr = *listenAddrArg
|
listenAddr = *listenAddrArg
|
||||||
}
|
}
|
||||||
|
|
||||||
mtu, err = strconv.Atoi(*mtuRead)
|
mtuInt, err = strconv.Atoi(*mtu)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("Failed to parse MTU: %v", err)
|
logger.Fatal("Failed to parse MTU: %v", err)
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ func ensureWireguardInterface(wgconfig WgConfig) error {
|
|||||||
return fmt.Errorf("failed to get interface: %v", err)
|
return fmt.Errorf("failed to get interface: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := netlink.LinkSetMTU(link, mtu); err != nil {
|
if err := netlink.LinkSetMTU(link, mtuInt); err != nil {
|
||||||
return fmt.Errorf("failed to set MTU: %v", err)
|
return fmt.Errorf("failed to set MTU: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user