netstack

package
v0.0.0-...-8e6527b Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFake is ...
	ErrNotFake = errors.New("not fake")
	// ErrNotFound is ...
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Device

type Device interface {
	io.Closer
	core.Device
}

Device is ...

type FakeUDPConn

type FakeUDPConn struct {
	*core.UDPConn
	// contains filtered or unexported fields
}

FakeUDPConn is ...

func NewFakeUDPConn

func NewFakeUDPConn(conn *core.UDPConn, target net.Addr, addr net.Addr) *FakeUDPConn

NewFakeUDPConn is ...

func (*FakeUDPConn) LocalAddr

func (conn *FakeUDPConn) LocalAddr() net.Addr

LocalAddr is ...

func (*FakeUDPConn) ReadTo

func (conn *FakeUDPConn) ReadTo(b []byte) (int, net.Addr, error)

ReadTo is ...

func (*FakeUDPConn) WriteFrom

func (conn *FakeUDPConn) WriteFrom(b []byte, addr net.Addr) (int, error)

WriteFrom is ...

type Stack

type Stack struct {
	// Stack is ...
	core.Stack
	// Handler is ...
	Handler gonet.Handler
	// Hijack is ...
	Hijack bool
	// contains filtered or unexported fields
}

Stack is core.Handler

func NewStack

func NewStack(handler gonet.Handler, resolver resolver.Resolver, tree *suffixtree.DomainTree, matcher geosite.Matcher, hijack bool) *Stack

NewStack is ....

func (*Stack) Handle

func (s *Stack) Handle(conn *core.TCPConn, target *net.TCPAddr)

Handle handles *core.TCPConn

func (*Stack) HandleMessage

func (s *Stack) HandleMessage(m *dns.Msg)

HandleMessage handles dns.Msg

func (*Stack) HandlePacket

func (s *Stack) HandlePacket(conn *core.UDPConn, target *net.UDPAddr)

HandlePacket handles core.UDPConn

func (*Stack) HandleQuery

func (s *Stack) HandleQuery(conn *core.UDPConn)

HandleQuery handles dns queries

func (*Stack) LookupAddr

func (s *Stack) LookupAddr(addr net.Addr) (net.Addr, error)

LookupAddr converts fake ip to real domain address

func (*Stack) LookupIP

func (s *Stack) LookupIP(addr net.IP) (*socks.Addr, error)

LookupIP converts fake ip to real domain address

func (*Stack) Start

func (s *Stack) Start(dev Device, lg logger.Logger, mtu int) error

Start is ...

type UDPConn

type UDPConn struct {
	*core.UDPConn
	Stack *Stack
}

UDPConn is ...

func NewUDPConn

func NewUDPConn(conn *core.UDPConn, stack *Stack) *UDPConn

NewUDPConn is ...

func (*UDPConn) ReadTo

func (conn *UDPConn) ReadTo(b []byte) (n int, addr net.Addr, err error)

ReadTo is ...

func (*UDPConn) WriteFrom

func (conn *UDPConn) WriteFrom(b []byte, addr net.Addr) (int, error)

WriteFrom is ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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