proxy

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2016 License: BSD-3-Clause Imports: 33 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 RegisterProxy

func RegisterProxy(p Proxy) error

func Start

func Start(home string) 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 DirectConfig

type DirectConfig struct {
	SNI         []string
	DialTimeout int
	ReadTimeout int
}

type EncryptConfig

type EncryptConfig struct {
	Method string
	Key    string
}

type Feature

type Feature struct {
	MaxRequestBody int
}

type GAEConfig

type GAEConfig struct {
	Enable         bool
	ServerList     []string
	SNI            []string
	InjectRange    []string
	ConnsPerServer int
	HTTPProxy      string
	DialTimeout    int
	ReadTimeout    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 LocalConfig

type LocalConfig struct {
	Log              []string
	Encrypt          EncryptConfig
	UserAgent        string
	Auth             string
	LocalDNS         LocalDNSConfig
	UDPGWAddr        string
	ChannelKeepAlive bool
	Admin            AdminConfig
	Proxy            []ProxyConfig
	PAAS             PAASConfig
	GAE              GAEConfig
	VPS              VPSConfig
	Direct           DirectConfig
}
var GConf LocalConfig

type LocalDNSConfig

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

type PAASConfig

type PAASConfig struct {
	Enable                  bool
	ServerList              []string
	ConnsPerServer          int
	SNI                     string
	SNIProxy                string
	HTTPProxy               string
	DialTimeout             int
	HTTPReadTimeout         int
	WSReadTimeout           int
	WSReconnectPeriod       int
	WSHeartBeatPeriod       int
	WSRCPRandomAdjustment   int
	HTTPRCPRandomAdjustment int
	HTTPReconnectPeriod     int
	HTTPChunkPushEnable     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() error
	Name() string
	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 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
}

type VPSConfig

type VPSConfig struct {
	Enable              bool
	Server              string
	ConnsPerServer      int
	HTTPProxy           string
	DialTimeout         int
	ReadTimeout         int
	ReconnectPeriod     int
	HeartBeatPeriod     int
	RCPRandomAdjustment int
}

Jump to

Keyboard shortcuts

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