github.com/labulakalia/water@v0.0.5-0.20231118024244-f351ca6784b6/if_linux.go (about) 1 package water 2 3 import ( 4 "fmt" 5 ) 6 7 // NewTAP creates a new TAP interface whose name is ifName. If ifName is empty, a 8 // default name (tap0, tap1, ... ) will be assigned. ifName should not exceed 9 // 16 bytes. TAP interfaces are not supported on darwin. 10 // ifName cannot be specified on windows, you will need ifce.Name() to use some cmds. 11 // 12 // Deprecated: This function may be removed in the future. Please use New() instead. 13 func NewTAP(ifName string) (ifce *Interface, err error) { 14 fmt.Println("Deprecated: NewTAP(..) may be removed in the future. Please use New() instead.") 15 config := Config{DeviceType: TAP} 16 config.Name = ifName 17 return openDev(config) 18 } 19 20 // NewTUN creates a new TUN interface whose name is ifName. If ifName is empty, a 21 // default name (tap0, tap1, ... ) will be assigned. ifName should not exceed 22 // ifName cannot be specified on windows, you will need ifce.Name() to use some cmds. 23 // 24 // Deprecated: This function will be removed in the future. Please use New() instead. 25 func NewTUN(ifName string) (ifce *Interface, err error) { 26 fmt.Println("Deprecated: NewTUN(..) may be removed in the future. Please use New() instead.") 27 config := Config{DeviceType: TUN} 28 config.Name = ifName 29 return openDev(config) 30 }