mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Add "IfTAPMode" configuration option to allow selecting TAP mode on supported platforms
This commit is contained in:
parent
869997e4c5
commit
e9bd98d213
6 changed files with 34 additions and 12 deletions
10
yggdrasil.go
10
yggdrasil.go
|
@ -39,6 +39,7 @@ type nodeConfig struct {
|
|||
Multicast bool
|
||||
LinkLocal string
|
||||
IfName string
|
||||
IfTAPMode bool
|
||||
}
|
||||
|
||||
type node struct {
|
||||
|
@ -104,7 +105,7 @@ func generateConfig() *nodeConfig {
|
|||
spub, spriv := core.DEBUG_newSigKeys()
|
||||
cfg := nodeConfig{}
|
||||
cfg.Listen = "[::]:0"
|
||||
cfg.AdminListen = "localhost:9001"
|
||||
cfg.AdminListen = "[::1]:9001"
|
||||
cfg.BoxPub = hex.EncodeToString(bpub[:])
|
||||
cfg.BoxPriv = hex.EncodeToString(bpriv[:])
|
||||
cfg.SigPub = hex.EncodeToString(spub[:])
|
||||
|
@ -113,6 +114,11 @@ func generateConfig() *nodeConfig {
|
|||
cfg.Multicast = true
|
||||
cfg.LinkLocal = ""
|
||||
cfg.IfName = "auto"
|
||||
if runtime.GOOS == "windows" {
|
||||
cfg.IfTAPMode = true
|
||||
} else {
|
||||
cfg.IfTAPMode = false
|
||||
}
|
||||
return &cfg
|
||||
}
|
||||
|
||||
|
@ -258,7 +264,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, 65535) // Largest supported MTU
|
||||
n.core.DEBUG_startTunWithMTU(cfg.IfName, cfg.IfTAPMode, 65535) // Largest supported MTU
|
||||
defer func() {
|
||||
logger.Println("Closing...")
|
||||
n.core.DEBUG_stopTun()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue