From 15d1b3ddbb407e4edc69db10047bb330787d18fc Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Tue, 23 May 2017 14:27:12 -0400 Subject: [PATCH] linux: Re-adds NewTAP/NewTUN Functions --- if_linux.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 if_linux.go diff --git a/if_linux.go b/if_linux.go new file mode 100644 index 0000000..7752dc0 --- /dev/null +++ b/if_linux.go @@ -0,0 +1,32 @@ +// +build linux + +package water + +import ( + "fmt" +) + +// NewTAP creates a new TAP interface whose name is ifName. If ifName is empty, a +// default name (tap0, tap1, ... ) will be assigned. ifName should not exceed +// 16 bytes. TAP interfaces are not supported on darwin. +// ifName cannot be specified on windows, you will need ifce.Name() to use some cmds. +// +// Deprecated: This function may be removed in the future. Please use New() instead. +func NewTAP(ifName string) (ifce *Interface, err error) { + fmt.Println("Deprecated: NewTAP(..) may be removed in the future. Please use New() instead.") + config := Config{DeviceType: TAP} + config.Name = ifName + return newTAP(config) +} + +// NewTUN creates a new TUN interface whose name is ifName. If ifName is empty, a +// default name (tap0, tap1, ... ) will be assigned. ifName should not exceed +// ifName cannot be specified on windows, you will need ifce.Name() to use some cmds. +// +// Deprecated: This function will be removed in the future. Please use New() instead. +func NewTUN(ifName string) (ifce *Interface, err error) { + fmt.Println("Deprecated: NewTUN(..) may be removed in the future. Please use New() instead.") + config := Config{DeviceType: TUN} + config.Name = ifName + return newTUN(config) +}