tunnel

package
v0.0.0-...-280623b Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ModeMapping is a mapping for Mode enum
	ModeMapping = map[string]Mode{
		Global.String(): Global,
		Rule.String():   Rule,
		Direct.String(): Direct,
	}
)

Functions

This section is empty.

Types

type Mode

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

func (Mode) MarshalJSON

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

MarshalJSON serialize Mode

func (Mode) String

func (m Mode) String() string

func (*Mode) UnmarshalJSON

func (m *Mode) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON unserialize Mode

func (*Mode) UnmarshalYAML

func (m *Mode) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

UnmarshalYAML unserialize Mode with yaml

type TrafficTrack

type TrafficTrack struct {
	net.Conn
	// contains filtered or unexported fields
}

TrafficTrack record traffic of net.Conn

func (*TrafficTrack) Read

func (tt *TrafficTrack) Read(b []byte) (int, error)

func (*TrafficTrack) Write

func (tt *TrafficTrack) Write(b []byte) (int, error)

type Tunnel

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

Tunnel handle relay inbound proxy and outbound proxy

func Instance

func Instance() *Tunnel

Instance return singleton instance of Tunnel

func (*Tunnel) Add

func (t *Tunnel) Add(req C.ServerAdapter)

Add request to queue

func (*Tunnel) Mode

func (t *Tunnel) Mode() Mode

Mode return current mode

func (*Tunnel) Proxies

func (t *Tunnel) Proxies() map[string]C.Proxy

Proxies return all proxies

func (*Tunnel) Rules

func (t *Tunnel) Rules() []C.Rule

Rules return all rules

func (*Tunnel) SetMode

func (t *Tunnel) SetMode(mode Mode)

SetMode change the mode of tunnel

func (*Tunnel) Traffic

func (t *Tunnel) Traffic() *C.Traffic

Traffic return traffic of all connections

func (*Tunnel) UpdateExperimental

func (t *Tunnel) UpdateExperimental(ignoreResolveFail bool)

UpdateExperimental handle update experimental config

func (*Tunnel) UpdateProxies

func (t *Tunnel) UpdateProxies(proxies map[string]C.Proxy)

UpdateProxies handle update proxies

func (*Tunnel) UpdateRules

func (t *Tunnel) UpdateRules(rules []C.Rule)

UpdateRules handle update rules

Jump to

Keyboard shortcuts

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