tunnel

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Add added in v0.19.0

func Add(req C.ServerAdapter)

Add request to queue

func AddPacket added in v0.19.0

func AddPacket(packet *inbound.PacketAdapter)

AddPacket add udp Packet to queue

func Providers added in v0.19.0

func Providers() map[string]provider.ProxyProvider

Providers return all compatible providers

func Proxies added in v0.19.0

func Proxies() map[string]C.Proxy

Proxies return all proxies

func Rules added in v0.19.0

func Rules() []C.Rule

Rules return all rules

func SetMode added in v0.19.0

func SetMode(m TunnelMode)

SetMode change the mode of tunnel

func SetResolver added in v0.19.0

func SetResolver(r *dns.Resolver)

SetResolver set custom dns resolver for enhanced mode

func UpdateProxies added in v0.19.0

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

UpdateProxies handle update proxies

func UpdateRules added in v0.19.0

func UpdateRules(newRules []C.Rule)

UpdateRules handle update rules

Types

type Manager added in v0.19.0

type Manager struct {
	// contains filtered or unexported fields
}
var DefaultManager *Manager

func (*Manager) Download added in v0.19.0

func (m *Manager) Download() chan<- int64

func (*Manager) Join added in v0.19.0

func (m *Manager) Join(c tracker)

func (*Manager) Leave added in v0.19.0

func (m *Manager) Leave(c tracker)

func (*Manager) Now added in v0.19.0

func (m *Manager) Now() (up int64, down int64)

func (*Manager) ResetStatistic added in v0.19.0

func (m *Manager) ResetStatistic()

func (*Manager) Snapshot added in v0.19.0

func (m *Manager) Snapshot() *Snapshot

func (*Manager) Upload added in v0.19.0

func (m *Manager) Upload() chan<- int64

type Snapshot added in v0.19.0

type Snapshot struct {
	DownloadTotal int64     `json:"downloadTotal"`
	UploadTotal   int64     `json:"uploadTotal"`
	Connections   []tracker `json:"connections"`
}

type TrafficTrack added in v0.6.0

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

TrafficTrack record traffic of net.Conn

func (*TrafficTrack) Read added in v0.6.0

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

func (*TrafficTrack) Write added in v0.6.0

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

type TunnelMode added in v0.19.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 v0.19.0

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

MarshalJSON serialize Mode

func (TunnelMode) MarshalYAML added in v0.19.0

func (m TunnelMode) MarshalYAML() (interface{}, error)

MarshalYAML serialize TunnelMode with yaml

func (TunnelMode) String added in v0.19.0

func (m TunnelMode) String() string

func (*TunnelMode) UnmarshalJSON added in v0.19.0

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

UnmarshalJSON unserialize Mode

func (*TunnelMode) UnmarshalYAML added in v0.19.0

func (m *TunnelMode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unserialize Mode with yaml

Jump to

Keyboard shortcuts

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