-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtun_if.go
35 lines (26 loc) · 843 Bytes
/
tun_if.go
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
31
32
33
34
35
//go:build linux
package tunnel
import "io"
type Config struct {
Name string // Name of the tunnel interface (e.g., "tun0")
Persist bool // Whether the tunnel interface should persist (remain after being closed)
Permissions *DevicePermissions // Permissions for the tunnel device
MultiQueue bool // Whether to enable multi-queue support
DisableGsoGro bool // Whether to disable gso/gro and VnetHDR
}
type DevicePermissions struct {
Owner uint // UID of the owner
Group uint // GID of the group
}
type Iface struct {
io.ReadWriteCloser
platformMethods
}
var zeroConfig Config
func defaltOSparms() Config { return Config{} }
func New(config Config) (*Iface, error) {
if config == zeroConfig {
config = defaltOSparms()
}
return openDevice(config)
}