5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 09:30:28 +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 LinkLocal string
IfName string IfName string
IfTAPMode bool IfTAPMode bool
IfMTU int
} }
type node struct { type node struct {
@ -114,6 +115,7 @@ func generateConfig() *nodeConfig {
cfg.Multicast = true cfg.Multicast = true
cfg.LinkLocal = "" cfg.LinkLocal = ""
cfg.IfName = "auto" cfg.IfName = "auto"
cfg.IfMTU = 65535
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
cfg.IfTAPMode = true cfg.IfTAPMode = true
} else { } else {
@ -264,7 +266,7 @@ func main() {
n.init(cfg, logger) n.init(cfg, logger)
logger.Println("Starting tun...") logger.Println("Starting tun...")
//n.core.DEBUG_startTun(cfg.IfName) // 1280, the smallest supported MTU //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() { defer func() {
logger.Println("Closing...") logger.Println("Closing...")
n.core.DEBUG_stopTun() n.core.DEBUG_stopTun()