5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-09 16:20:26 +00:00

Add "IfMTU" configuration option to allow selecting TUN/TAP MTU

This commit is contained in:
Neil Alexander 2018-02-14 12:53:32 +00:00
parent 7a0b48ffb3
commit 9fb45d77fc

View File

@ -40,6 +40,7 @@ type nodeConfig struct {
LinkLocal string
IfName string
IfTAPMode bool
IfMTU int
}
type node struct {
@ -114,6 +115,7 @@ func generateConfig() *nodeConfig {
cfg.Multicast = true
cfg.LinkLocal = ""
cfg.IfName = "auto"
cfg.IfMTU = 65535
if runtime.GOOS == "windows" {
cfg.IfTAPMode = true
} else {
@ -264,7 +266,7 @@ func main() {
n.init(cfg, logger)
logger.Println("Starting tun...")
//n.core.DEBUG_startTun(cfg.IfName) // 1280, the smallest supported MTU
n.core.DEBUG_startTunWithMTU(cfg.IfName, cfg.IfTAPMode, 65535) // Largest supported MTU
n.core.DEBUG_startTunWithMTU(cfg.IfName, cfg.IfTAPMode, cfg.IfMTU) // Largest supported MTU
defer func() {
logger.Println("Closing...")
n.core.DEBUG_stopTun()