summaryrefslogtreecommitdiffhomepage
path: root/device.go
diff options
context:
space:
mode:
Diffstat (limited to 'device.go')
-rw-r--r--device.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/device.go b/device.go
index 79ec0b8..5adf33a 100644
--- a/device.go
+++ b/device.go
@@ -255,7 +255,15 @@ func NewDevice(tun TUNDevice, logger *Logger) *Device {
device.isClosed.Set(false)
device.log = logger
+
device.tun.device = tun
+ mtu, err := device.tun.device.MTU()
+ if err != nil {
+ logger.Error.Println("Trouble determining MTU, assuming 1420:", err)
+ mtu = 1420
+ }
+ device.tun.mtu = int32(mtu)
+
device.peers.keyMap = make(map[NoisePublicKey]*Peer)
// initialize anti-DoS / anti-scanning features