if_linux.go 1.2 KB

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