proxy

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2016 License: BSD-3-Clause Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChannelAuthFailed = errors.New("Remote channel auth failed")
View Source
var ErrChannelReadTimeout = errors.New("Remote channel read timeout")

Functions

func HandleEvent

func HandleEvent(ev event.Event) error

func MatchRegexs

func MatchRegexs(str string, rules []*regexp.Regexp) bool

func NewAuthEvent

func NewAuthEvent(secureTransport bool) *event.AuthEvent

func NewRegex

func NewRegex(rules []string) ([]*regexp.Regexp, error)

func RegisterProxyType added in v0.24.1

func RegisterProxyType(str string, p Proxy) error

func Start

func Start(home string, monitor InternalEventMonitor) error

func Stop

func Stop() error

func SyncConfig

func SyncConfig(addr string, localDir string) error

Types

type AdminConfig

type AdminConfig struct {
	Listen    string
	ConfigDir string
}

type EncryptConfig

type EncryptConfig struct {
	Method string
	Key    string
}

type Feature

type Feature struct {
	MaxRequestBody int
}

type IPRange

type IPRange struct {
	Start, End uint64
	Country    string
}

type IPRangeHolder

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

func (*IPRangeHolder) Clear

func (h *IPRangeHolder) Clear()

func (*IPRangeHolder) FindCountry

func (h *IPRangeHolder) FindCountry(ip string) (string, error)

func (*IPRangeHolder) Len

func (h *IPRangeHolder) Len() int

func (*IPRangeHolder) Less

func (h *IPRangeHolder) Less(i, j int) bool

Less returns whether the element with index i should sort before the element with index j.

func (*IPRangeHolder) Swap

func (h *IPRangeHolder) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type InternalEventMonitor added in v0.24.1

type InternalEventMonitor func(code int, desc string) error

type LocalConfig

type LocalConfig struct {
	Log              []string
	Encrypt          EncryptConfig
	UserAgent        string
	Auth             string
	LocalDNS         LocalDNSConfig
	UDPGWAddr        string
	ChannelKeepAlive bool
	Admin            AdminConfig
	Proxy            []ProxyConfig
	Channel          []ProxyChannelConfig
}
var GConf LocalConfig

type LocalDNSConfig

type LocalDNSConfig struct {
	Listen     string
	TrustedDNS []string
	TCPConnect bool
}

type PACConfig

type PACConfig struct {
	Method   []string
	Host     []string
	Path     []string
	Rule     []string
	Protocol []string
	Remote   string
	// contains filtered or unexported fields
}

func (*PACConfig) Match

func (pac *PACConfig) Match(protocol string, ip string, req *http.Request) bool

type Proxy

type Proxy interface {
	Init(conf ProxyChannelConfig) error
	//Type() string
	Config() *ProxyChannelConfig
	Destory() error
	Features() Feature
	PrintStat(w io.Writer)
	Serve(session *ProxySession, ev event.Event) error
}

type ProxyChannel

type ProxyChannel interface {
	Write(event.Event) (event.Event, error)
}

type ProxyChannelConfig added in v0.24.1

type ProxyChannelConfig struct {
	Enable              bool
	Name                string
	Type                string
	ServerList          []string
	ConnsPerServer      int
	SNI                 []string
	SNIProxy            string
	HTTPProxy           string
	DialTimeout         int
	ReadTimeout         int
	ReconnectPeriod     int
	HeartBeatPeriod     int
	RCPRandomAdjustment int
	HTTPChunkPushEnable bool
	ForceTLS            bool
}

func (*ProxyChannelConfig) IsDirect added in v0.24.1

func (c *ProxyChannelConfig) IsDirect() bool

type ProxyConfig

type ProxyConfig struct {
	Local    string
	PAC      []PACConfig
	SNISniff bool
}

type ProxySession

type ProxySession struct {
	Remote      *RemoteChannel
	Hijacked    bool
	SSLHijacked bool
	// contains filtered or unexported fields
}

func (*ProxySession) Close

func (s *ProxySession) Close() error

func (*ProxySession) SetRemoteChannel

func (s *ProxySession) SetRemoteChannel(r *RemoteChannel)

type RangeFetcher

type RangeFetcher struct {
	SingleFetchLimit  int64
	ConcurrentFetcher int32
	C                 *RemoteChannel
}

func (*RangeFetcher) Fetch

type RemoteChannel

type RemoteChannel struct {
	Addr                string
	Index               int
	DirectIO            bool
	WriteJoinAuth       bool
	OpenJoinAuth        bool
	SecureTransport     bool
	HeartBeatPeriod     int
	ReconnectPeriod     int
	RCPRandomAdjustment int
	C                   RemoteProxyChannel
	// contains filtered or unexported fields
}

func (*RemoteChannel) Close

func (rc *RemoteChannel) Close()

func (*RemoteChannel) GetActiveSessionNum

func (rc *RemoteChannel) GetActiveSessionNum() int32

func (*RemoteChannel) Init

func (rc *RemoteChannel) Init(authRequired bool) error

func (*RemoteChannel) Request

func (rc *RemoteChannel) Request(ev event.Event) (event.Event, error)

func (*RemoteChannel) Stop

func (rc *RemoteChannel) Stop()

func (*RemoteChannel) Write

func (rc *RemoteChannel) Write(ev event.Event) error

func (*RemoteChannel) WriteRaw

func (rc *RemoteChannel) WriteRaw(p []byte) (int, error)

type RemoteChannelTable

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

func NewRemoteChannelTable

func NewRemoteChannelTable() *RemoteChannelTable

func (*RemoteChannelTable) Add

func (p *RemoteChannelTable) Add(c *RemoteChannel)

func (*RemoteChannelTable) PrintStat

func (p *RemoteChannelTable) PrintStat(w io.Writer)

func (*RemoteChannelTable) Select

func (p *RemoteChannelTable) Select() *RemoteChannel

func (*RemoteChannelTable) StopAll

func (p *RemoteChannelTable) StopAll()

type RemoteProxyChannel

type RemoteProxyChannel interface {
	Open() error
	SetCryptoCtx(ctx *event.CryptoContext)
	Closed() bool
	Request([]byte) ([]byte, error)
	ReadTimeout() time.Duration
	HandleCtrlEvent(ev event.Event)
	io.ReadWriteCloser
}

Jump to

Keyboard shortcuts

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