engine

package
v0.0.0-...-7897c6d Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuffSize          = 1500
	ChanSize          = 15000
	VPNStreamProtocol = "/NetHive/vpn"
)
View Source
const (
	DHTRetryInterval = 5 * time.Minute
)
View Source
const (
	MDNSRetryInterval = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

func Run

func Run(ctx context.Context, cfg *config.Config) (*Engine, error)

func (*Engine) EnableDHT

func (e *Engine) EnableDHT() error

func (*Engine) EnableMdns

func (e *Engine) EnableMdns() error

func (*Engine) HandlePeerFound

func (e *Engine) HandlePeerFound(info peer.AddrInfo)

func (*Engine) RoutineRouteTableWriter

func (e *Engine) RoutineRouteTableWriter()

RoutineRouteTableWriter loop sending the data packet to the corresponding channel according to the routing table

func (*Engine) RoutineTUNReader

func (e *Engine) RoutineTUNReader()

RoutineTUNReader loop to read packets from TUN

func (*Engine) RoutineTUNWriter

func (e *Engine) RoutineTUNWriter()

RoutineTUNWriter loop writing packets to TUN

func (*Engine) Run

func (e *Engine) Run() error

func (*Engine) SearchNode

func (e *Engine) SearchNode(ctx context.Context, id peer.ID) <-chan peer.AddrInfo

func (*Engine) VPNHandler

func (e *Engine) VPNHandler(stream network.Stream)

type PacketChan

type PacketChan chan *Payload

type Payload

type Payload struct {
	Src  netip.Addr
	Dst  netip.Addr
	Data []byte
}

Jump to

Keyboard shortcuts

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