userClose windows.Handle
events chan TUNEvent
errors chan error
+ forcedMtu int
}
func packetAlign(size uint32) uint32 {
wrBuff: &exchgBufWrite{},
events: make(chan TUNEvent, 10),
errors: make(chan error, 1),
+ forcedMtu: 1500,
}
// Create close event.
}
func (tun *NativeTun) MTU() (int, error) {
- return 1500, nil
+ return tun.forcedMtu, nil
+}
+
+//TODO: This is a temporary hack. We really need to be monitoring the interface in real time and adapting to MTU changes.
+func (tun *NativeTun) ForceMtu(mtu int) {
+ tun.forcedMtu = mtu
}
func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {