Documentation ¶
Index ¶
- type Iface
- func (i *Iface) Close() error
- func (i *Iface) DeleteNetRoute(destNet net.IPNet) error
- func (i *Iface) DestIP() net.IP
- func (i *Iface) DeviceIPNet() net.IPNet
- func (i *Iface) Name() string
- func (i *Iface) Read(pkt []byte) (int, error)
- func (i *Iface) ServeByConn(conn io.ReadWriteCloser) error
- func (i *Iface) ServeByDeviceData(openRWC OpenRWC) (bool, error)
- func (i *Iface) SudoAddNetRoute(destNet net.IPNet) error
- func (i *Iface) SudoSetup() error
- func (i *Iface) Write(pkt []byte) (int, error)
- type OpenRWC
- type PacketIP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iface ¶
type Iface struct {
// contains filtered or unexported fields
}
func (*Iface) DeviceIPNet ¶
func (*Iface) Name ¶
Name returns device name. On macOS, it is generated by system, but not from `name` param of `New(...)` function.
func (*Iface) ServeByConn ¶
func (i *Iface) ServeByConn(conn io.ReadWriteCloser) error
ServeByConn starts VPN after accept `.vpn` stream.
func (*Iface) ServeByDeviceData ¶
ServeByDeviceData starts VPN after device accepted IP packet. 只有从虚拟网卡中读到数据,才去建立`.vpn` stream,并进行交换
func (*Iface) SudoAddNetRoute ¶
SudoAddNetRoute add `net` type route, all traffic sent to destNet will be forward to current TUN/TAP device.
type OpenRWC ¶
type OpenRWC = func() (io.ReadWriteCloser, error)
Click to show internal directories.
Click to hide internal directories.