tunnel

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const DnsRespectRules = "RULES"

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 = tunnel{}

Functions

func FakeIPRange added in v1.17.0

func FakeIPRange() netip.Prefix

func FindProcessMode added in v1.18.8

func FindProcessMode() P.FindProcessMode

func IsSniffing added in v1.17.0

func IsSniffing() bool

func Listeners added in v1.17.0

func Listeners() map[string]C.InboundListener

func NatTable added in v1.17.0

func NatTable() C.NatTable

NatTable return nat table

func OnInnerLoading added in v1.17.0

func OnInnerLoading()

func OnRunning added in v1.17.0

func OnRunning()

func OnSuspend added in v1.17.0

func OnSuspend()

func Providers added in v1.17.0

func Providers() map[string]provider.ProxyProvider

Providers return all compatible providers

func Proxies added in v1.17.0

func Proxies() map[string]C.Proxy

Proxies return all proxies

func ProxiesWithProviders added in v1.17.0

func ProxiesWithProviders() map[string]C.Proxy

func RuleProviders added in v1.17.0

func RuleProviders() map[string]provider.RuleProvider

RuleProviders return all loaded rule providers

func Rules added in v1.17.0

func Rules() []C.Rule

Rules return all rules

func SetFakeIPRange added in v1.17.0

func SetFakeIPRange(p netip.Prefix)

func SetFindProcessMode added in v1.17.0

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 added in v1.17.0

func SetMode(m TunnelMode)

SetMode change the mode of tunnel

func SetSniffing added in v1.17.0

func SetSniffing(b bool)

func TCPIn added in v1.17.0

func TCPIn() chan<- C.ConnContext

TCPIn return fan-in queue Deprecated: using Tunnel instead

func UDPIn added in v1.17.0

func UDPIn() chan<- C.PacketAdapter

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

func UpdateListeners added in v1.17.0

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

func UpdateProxies added in v1.17.0

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

UpdateProxies handle update proxies

func UpdateRules added in v1.17.0

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

UpdateRules handle update rules

func UpdateSniffer added in v1.17.0

func UpdateSniffer(dispatcher *sniffer.Dispatcher)

Types

type AtomicStatus added in v1.17.0

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

func (*AtomicStatus) Load added in v1.17.0

func (a *AtomicStatus) Load() TunnelStatus

func (*AtomicStatus) Store added in v1.17.0

func (a *AtomicStatus) Store(s TunnelStatus)

func (*AtomicStatus) String added in v1.17.0

func (a *AtomicStatus) String() string

type DNSDialer added in v1.18.6

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

func NewDNSDialer added in v1.18.6

func NewDNSDialer(r resolver.Resolver, proxyAdapter C.ProxyAdapter, proxyName string, opts ...dialer.Option) *DNSDialer

func (*DNSDialer) DialContext added in v1.18.6

func (d *DNSDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

func (*DNSDialer) ListenPacket added in v1.18.6

func (d *DNSDialer) ListenPacket(ctx context.Context, network, addr string) (net.PacketConn, error)

type TunnelMode added in v1.17.0

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

func Mode added in v0.5.0

func Mode() TunnelMode

Mode return current mode

func (TunnelMode) MarshalJSON added in v1.17.0

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

MarshalJSON serialize Mode

func (TunnelMode) MarshalText added in v1.18.9

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

MarshalText serialize Mode

func (TunnelMode) MarshalYAML added in v1.17.0

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

MarshalYAML serialize TunnelMode with yaml

func (TunnelMode) String added in v1.17.0

func (m TunnelMode) String() string

func (*TunnelMode) UnmarshalJSON added in v1.17.0

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

UnmarshalJSON unserialize Mode

func (*TunnelMode) UnmarshalText added in v1.18.9

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

UnmarshalText unserialize Mode

func (*TunnelMode) UnmarshalYAML added in v1.17.0

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

UnmarshalYAML unserialize Mode with yaml

type TunnelStatus added in v1.17.0

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

func Status added in v1.17.0

func Status() TunnelStatus

func (TunnelStatus) MarshalJSON added in v1.17.0

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

MarshalJSON serialize Status

func (TunnelStatus) MarshalText added in v1.18.9

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

MarshalText serialize Status

func (TunnelStatus) MarshalYAML added in v1.17.0

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

MarshalYAML serialize TunnelMode with yaml

func (TunnelStatus) String added in v1.17.0

func (s TunnelStatus) String() string

func (*TunnelStatus) UnmarshalJSON added in v1.17.0

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

UnmarshalJSON unserialize Status

func (*TunnelStatus) UnmarshalText added in v1.18.9

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

UnmarshalText unserialize Status

func (*TunnelStatus) UnmarshalYAML added in v1.17.0

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