tunnel

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModeMapping = map[string]TunnelMode{
	Global.String(): Global,
	Rule.String():   Rule,
	Direct.String(): Direct,
}

ModeMapping is a mapping for Mode enum

View Source
var StatusMapping = map[string]TunnelStatus{
	Suspend.String(): Suspend,
	Inner.String():   Inner,
	Running.String(): Running,
}

StatusMapping is a mapping for Status enum

View Source
var Tunnel C.Tunnel = tunnel{}

Functions

func FakeIPRange

func FakeIPRange() netip.Prefix

func IsSniffing

func IsSniffing() bool

func Listeners

func Listeners() map[string]C.InboundListener

func NatTable

func NatTable() C.NatTable

NatTable return nat table

func OnInnerLoading

func OnInnerLoading()

func OnRunning

func OnRunning()

func OnSuspend

func OnSuspend()

func Providers

func Providers() map[string]provider.ProxyProvider

Providers return all compatible providers

func Proxies

func Proxies() map[string]C.Proxy

Proxies return all proxies

func ProxiesWithProviders

func ProxiesWithProviders() map[string]C.Proxy

func RuleProviders

func RuleProviders() map[string]provider.RuleProvider

RuleProviders return all loaded rule providers

func Rules

func Rules() []C.Rule

Rules return all rules

func SetFakeIPRange

func SetFakeIPRange(p netip.Prefix)

func SetFindProcessMode

func SetFindProcessMode(mode P.FindProcessMode)

SetFindProcessMode replace SetAlwaysFindProcess always find process info if legacyAlways = true or mode.Always() = true, may be increase many memory

func SetMode

func SetMode(m TunnelMode)

SetMode change the mode of tunnel

func SetSniffing

func SetSniffing(b bool)

func TCPIn

func TCPIn() chan<- C.ConnContext

TCPIn return fan-in queue Deprecated: using Tunnel instead

func UDPIn

func UDPIn() chan<- C.PacketAdapter

UDPIn return fan-in udp queue Deprecated: using Tunnel instead

func UpdateListeners

func UpdateListeners(newListeners map[string]C.InboundListener)

func UpdateProxies

func UpdateProxies(newProxies map[string]C.Proxy, newProviders map[string]provider.ProxyProvider)

UpdateProxies handle update proxies

func UpdateRules

func UpdateRules(newRules []C.Rule, newSubRule map[string][]C.Rule, rp map[string]provider.RuleProvider)

UpdateRules handle update rules

func UpdateSniffer

func UpdateSniffer(dispatcher *sniffer.SnifferDispatcher)

Types

type AtomicStatus

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

func (*AtomicStatus) Load

func (a *AtomicStatus) Load() TunnelStatus

func (*AtomicStatus) Store

func (a *AtomicStatus) Store(s TunnelStatus)

func (*AtomicStatus) String

func (a *AtomicStatus) String() string

type TunnelMode

type TunnelMode int
const (
	Global TunnelMode = iota
	Rule
	Direct
)

func Mode

func Mode() TunnelMode

Mode return current mode

func (TunnelMode) MarshalJSON

func (m TunnelMode) MarshalJSON() ([]byte, error)

MarshalJSON serialize Mode

func (TunnelMode) MarshalYAML

func (m TunnelMode) MarshalYAML() (any, error)

MarshalYAML serialize TunnelMode with yaml

func (TunnelMode) String

func (m TunnelMode) String() string

func (*TunnelMode) UnmarshalJSON

func (m *TunnelMode) UnmarshalJSON(data []byte) error

UnmarshalJSON unserialize Mode

func (*TunnelMode) UnmarshalYAML

func (m *TunnelMode) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML unserialize Mode with yaml

type TunnelStatus

type TunnelStatus int
const (
	Suspend TunnelStatus = iota
	Inner
	Running
)

func Status

func Status() TunnelStatus

func (TunnelStatus) MarshalJSON

func (s TunnelStatus) MarshalJSON() ([]byte, error)

MarshalJSON serialize Status

func (TunnelStatus) MarshalYAML

func (s TunnelStatus) MarshalYAML() (any, error)

MarshalYAML serialize TunnelMode with yaml

func (TunnelStatus) String

func (s TunnelStatus) String() string

func (*TunnelStatus) UnmarshalJSON

func (s *TunnelStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON unserialize Status

func (*TunnelStatus) UnmarshalYAML

func (s *TunnelStatus) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML unserialize Status with yaml

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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