tun

package
v5.16.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_app_tun_config_proto protoreflect.FileDescriptor

Functions

func NewDeviceWithSorter

func NewDeviceWithSorter(overlay device.Device, sorter *tunsorter.TunSorter) device.Device

Types

type Config

type Config struct {
	Name                  string                    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Mtu                   uint32                    `protobuf:"varint,2,opt,name=mtu,proto3" json:"mtu,omitempty"`
	UserLevel             uint32                    `protobuf:"varint,3,opt,name=user_level,json=userLevel,proto3" json:"user_level,omitempty"`
	PacketEncoding        packetaddr.PacketAddrType `` /* 150-byte string literal not displayed */
	Tag                   string                    `protobuf:"bytes,5,opt,name=tag,proto3" json:"tag,omitempty"`
	Ips                   []*routercommon.CIDR      `protobuf:"bytes,6,rep,name=ips,proto3" json:"ips,omitempty"`
	Routes                []*routercommon.CIDR      `protobuf:"bytes,7,rep,name=routes,proto3" json:"routes,omitempty"`
	EnablePromiscuousMode bool                      `` /* 127-byte string literal not displayed */
	EnableSpoofing        bool                      `protobuf:"varint,9,opt,name=enable_spoofing,json=enableSpoofing,proto3" json:"enable_spoofing,omitempty"`
	SocketSettings        *internet.SocketConfig    `protobuf:"bytes,10,opt,name=socket_settings,json=socketSettings,proto3" json:"socket_settings,omitempty"`
	SniffingSettings      *proxyman.SniffingConfig  `protobuf:"bytes,11,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetEnablePromiscuousMode

func (x *Config) GetEnablePromiscuousMode() bool

func (*Config) GetEnableSpoofing

func (x *Config) GetEnableSpoofing() bool

func (*Config) GetIps

func (x *Config) GetIps() []*routercommon.CIDR

func (*Config) GetMtu

func (x *Config) GetMtu() uint32

func (*Config) GetName

func (x *Config) GetName() string

func (*Config) GetPacketEncoding

func (x *Config) GetPacketEncoding() packetaddr.PacketAddrType

func (*Config) GetRoutes

func (x *Config) GetRoutes() []*routercommon.CIDR

func (*Config) GetSniffingSettings added in v5.11.0

func (x *Config) GetSniffingSettings() *proxyman.SniffingConfig

func (*Config) GetSocketSettings

func (x *Config) GetSocketSettings() *internet.SocketConfig

func (*Config) GetTag

func (x *Config) GetTag() string

func (*Config) GetUserLevel

func (x *Config) GetUserLevel() uint32

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type StackOption

type StackOption func(*stack.Stack) error

func AddProtocolAddress

func AddProtocolAddress(id tcpip.NICID, ips []*routercommon.CIDR) StackOption

func CreateNIC

func CreateNIC(id tcpip.NICID, linkEndpoint stack.LinkEndpoint) StackOption

func SetPromiscuousMode

func SetPromiscuousMode(id tcpip.NICID, enable bool) StackOption

func SetRouteTable

func SetRouteTable(id tcpip.NICID, routes []*routercommon.CIDR) StackOption

func SetSpoofing

func SetSpoofing(id tcpip.NICID, enable bool) StackOption

func SetTCPHandler

func SetTCPHandler(ctx context.Context, dispatcher routing.Dispatcher, policyManager policy.Manager, config *Config) StackOption

func SetTCPReceiveBufferSize

func SetTCPReceiveBufferSize(size int) StackOption

func SetTCPSendBufferSize

func SetTCPSendBufferSize(size int) StackOption

func SetUDPHandler

func SetUDPHandler(ctx context.Context, dispatcher routing.Dispatcher, policyManager policy.Manager, config *Config) StackOption

type TCPHandler

type TCPHandler struct {
	// contains filtered or unexported fields
}

func (*TCPHandler) Handle

func (h *TCPHandler) Handle(conn tun_net.TCPConn) error

type TUN

type TUN struct {
	// contains filtered or unexported fields
}

func (*TUN) Close

func (t *TUN) Close() error

func (*TUN) CreateStack

func (t *TUN) CreateStack(linkedEndpoint stack.LinkEndpoint) (*stack.Stack, error)

func (*TUN) Init

func (t *TUN) Init(ctx context.Context, config *Config, dispatcher routing.Dispatcher, policyManager policy.Manager) error

func (*TUN) Start

func (t *TUN) Start() error

func (*TUN) Type

func (t *TUN) Type() interface{}

type UDPHandler

type UDPHandler struct {
	// contains filtered or unexported fields
}

func (*UDPHandler) Handle

func (h *UDPHandler) Handle(conn tun_net.UDPConn) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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