tun

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDnsReadTimeout = time.Second * 10
View Source
const DefaultDnsRelayTimeout = time.Second * 5

Variables

This section is empty.

Functions

func CalculateInterfaceName

func CalculateInterfaceName() (tunName string)

func RelayDnsPacket

func RelayDnsPacket(ctx context.Context, payload []byte) ([]byte, error)

Types

type Listener

type Listener struct {
	TunName string
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Tun, tcpIn chan<- constant.ConnContext, udpIn chan<- *inbound.PacketAdapter) (l *Listener, err error)

func (*Listener) Address

func (l *Listener) Address() string

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Config

func (l *Listener) Config() config.Tun

func (*Listener) FlushDefaultInterface

func (l *Listener) FlushDefaultInterface()

type ListenerHandler

type ListenerHandler struct {
	sing.ListenerHandler
	DnsAdds []netip.AddrPort
}

func (*ListenerHandler) NewConnection

func (h *ListenerHandler) NewConnection(ctx context.Context, conn net.Conn, metadata metadata.Metadata) error

func (*ListenerHandler) NewPacketConnection

func (h *ListenerHandler) NewPacketConnection(ctx context.Context, conn network.PacketConn, metadata metadata.Metadata) error

func (*ListenerHandler) ShouldHijackDns

func (h *ListenerHandler) ShouldHijackDns(targetAddr netip.AddrPort) bool

Jump to

Keyboard shortcuts

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