File: if_linux.go

package info (click to toggle)
golang-github-songgao-water 0.0~git20200317.2b4b6d7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: makefile: 21
file content (30 lines) | stat: -rw-r--r-- 1,233 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 openDev(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 openDev(config)
}