Centralise platform defaults into the 'defaults' package

This commit is contained in:
Neil Alexander 2018-07-07 12:08:52 +01:00
parent adc21baa28
commit 1692bd98fd
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
20 changed files with 169 additions and 105 deletions

View file

@ -9,6 +9,7 @@ import (
"regexp"
"yggdrasil/config"
"yggdrasil/defaults"
)
// The Core object represents the Yggdrasil node. You should create a Core
@ -197,26 +198,31 @@ func (c *Core) AddAllowedEncryptionPublicKey(boxStr string) error {
return c.admin.addAllowedEncryptionPublicKey(boxStr)
}
// Gets the default admin listen address for your platform.
func (c *Core) GetAdminDefaultListen() string {
return defaults.GetDefaults().DefaultAdminListen
}
// Gets the default TUN/TAP interface name for your platform.
func (c *Core) GetTUNDefaultIfName() string {
return getDefaults().defaultIfName
return defaults.GetDefaults().DefaultIfName
}
// Gets the default TUN/TAP interface MTU for your platform. This can be as high
// as 65535, depending on platform, but is never lower than 1280.
func (c *Core) GetTUNDefaultIfMTU() int {
return getDefaults().defaultIfMTU
return defaults.GetDefaults().DefaultIfMTU
}
// Gets the maximum supported TUN/TAP interface MTU for your platform. This
// can be as high as 65535, depending on platform, but is never lower than 1280.
func (c *Core) GetTUNMaximumIfMTU() int {
return getDefaults().maximumIfMTU
return defaults.GetDefaults().MaximumIfMTU
}
// Gets the default TUN/TAP interface mode for your platform.
func (c *Core) GetTUNDefaultIfTAPMode() bool {
return getDefaults().defaultIfTAPMode
return defaults.GetDefaults().DefaultIfTAPMode
}
// Gets the current TUN/TAP interface name.