mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-23 03:11:35 +00:00
Update platform defaults, handling of 'auto' on Linux/Darwin
This commit is contained in:
parent
15726fe90d
commit
7d00206f4b
@ -20,6 +20,6 @@ func GetDefaults() platformDefaultParameters {
|
|||||||
// TUN/TAP
|
// TUN/TAP
|
||||||
MaximumIfMTU: 32767,
|
MaximumIfMTU: 32767,
|
||||||
DefaultIfMTU: 32767,
|
DefaultIfMTU: 32767,
|
||||||
DefaultIfName: "/dev/tap0",
|
DefaultIfName: "/dev/tun0",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// +build netbsd
|
|
||||||
|
|
||||||
package defaults
|
|
||||||
|
|
||||||
// Sane defaults for the BSD platforms. The "default" options may be
|
|
||||||
// may be replaced by the running configuration.
|
|
||||||
func GetDefaults() platformDefaultParameters {
|
|
||||||
return platformDefaultParameters{
|
|
||||||
// Admin
|
|
||||||
DefaultAdminListen: "unix:///var/run/yggdrasil.sock",
|
|
||||||
|
|
||||||
// Configuration (used for yggdrasilctl)
|
|
||||||
DefaultConfigFile: "/etc/yggdrasil.conf",
|
|
||||||
|
|
||||||
// Multicast interfaces
|
|
||||||
DefaultMulticastInterfaces: []string{
|
|
||||||
".*",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN/TAP
|
|
||||||
MaximumIfMTU: 9000,
|
|
||||||
DefaultIfMTU: 9000,
|
|
||||||
DefaultIfName: "/dev/tun0",
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
// +build !linux,!darwin,!windows,!openbsd,!freebsd,!netbsd
|
// +build !linux,!darwin,!windows,!openbsd,!freebsd
|
||||||
|
|
||||||
package defaults
|
package defaults
|
||||||
|
|
||||||
|
@ -20,6 +20,6 @@ func GetDefaults() platformDefaultParameters {
|
|||||||
// TUN/TAP
|
// TUN/TAP
|
||||||
MaximumIfMTU: 65535,
|
MaximumIfMTU: 65535,
|
||||||
DefaultIfMTU: 65535,
|
DefaultIfMTU: 65535,
|
||||||
DefaultIfName: "auto",
|
DefaultIfName: "Yggdrasil",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,9 @@ import (
|
|||||||
|
|
||||||
// Configures the "utun" adapter with the correct IPv6 address and MTU.
|
// Configures the "utun" adapter with the correct IPv6 address and MTU.
|
||||||
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
|
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
|
||||||
|
if ifname == "auto" {
|
||||||
|
ifname = "utun"
|
||||||
|
}
|
||||||
iface, err := wgtun.CreateTUN(ifname, mtu)
|
iface, err := wgtun.CreateTUN(ifname, mtu)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -11,6 +11,9 @@ import (
|
|||||||
|
|
||||||
// Configures the TUN adapter with the correct IPv6 address and MTU.
|
// Configures the TUN adapter with the correct IPv6 address and MTU.
|
||||||
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
|
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
|
||||||
|
if ifname == "auto" {
|
||||||
|
ifname = "\000"
|
||||||
|
}
|
||||||
iface, err := wgtun.CreateTUN(ifname, mtu)
|
iface, err := wgtun.CreateTUN(ifname, mtu)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user