proxy

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2016 License: BSD-3-Clause Imports: 31 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() *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

Types

type DirectConfig

type DirectConfig struct {
	SNI []string
}

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
}

type IPRange

type IPRange struct {
	Start, End uint64
	Country    string
}

type IPRangeHolder

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

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
	UDPGWAddr string
	Proxy     []ProxyConfig
	PAAS      PAASConfig
	GAE       GAEConfig
	VPS       VPSConfig
	LocalDNS  LocalDNSConfig
	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
}

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
	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
}

type ProxySession

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

func (*ProxySession) Close

func (s *ProxySession) Close() error

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
	HeartBeat     bool
	C             RemoteProxyChannel
	// contains filtered or unexported fields
}

func (*RemoteChannel) Close

func (rc *RemoteChannel) Close()

func (*RemoteChannel) Init

func (rc *RemoteChannel) Init() 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) Select

func (p *RemoteChannelTable) Select() *RemoteChannel

func (*RemoteChannelTable) StopAll

func (p *RemoteChannelTable) StopAll()

type RemoteProxyChannel

type RemoteProxyChannel interface {
	Open(iv uint64) error
	Closed() bool
	Request([]byte) ([]byte, error)
	io.ReadWriteCloser
}

type VPSConfig

type VPSConfig struct {
	Enable         bool
	Server         string
	ConnsPerServer int
	HTTPProxy      string
}

Jump to

Keyboard shortcuts

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