tun

package
v0.0.0-...-5e50992 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Read() ([]byte, error)
	Write([]byte) error
}

type Tun

type Tun struct {
	Name string
	// contains filtered or unexported fields
}

func AllocTun

func AllocTun() *Tun

func (*Tun) AddRoute

func (tun *Tun) AddRoute(cidr string) error

func (*Tun) DelRoute

func (tun *Tun) DelRoute(cidr string) error

func (*Tun) Read

func (tun *Tun) Read() ([]byte, error)

func (*Tun) SetAddress

func (tun *Tun) SetAddress(addr, gateway string) error

func (*Tun) Write

func (tun *Tun) Write(p []byte) (err error)

type Wrapper

type Wrapper struct {
	io.ReadWriter
}

Wrapper MacOS有4字节的头需要处理一下

func (*Wrapper) Read

func (tun *Wrapper) Read() ([]byte, error)

func (*Wrapper) Write

func (tun *Wrapper) Write(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL