proxy

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: BSD-3-Clause Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockedByGFWRule = "BlockedByGFW"
	InHostsRule      = "InHosts"
	IsCNIPRule       = "IsCNIP"
)
View Source
const (
	SO_ORIGINAL_DST      = 80
	IP6T_SO_ORIGINAL_DST = 80
	IPV6_RECVORIGDSTADDR = 74
)

Variables

This section is empty.

Functions

func DialServerByConf added in v0.27.2

func DialServerByConf(server string, conf *ProxyChannelConfig) (net.Conn, error)

func DnsGetDoaminIP added in v0.26.2

func DnsGetDoaminIP(domain string) (string, error)

func InitialPMuxConfig added in v0.27.0

func InitialPMuxConfig(conf *ProxyChannelConfig) *pmux.Config

func MatchPatterns added in v0.26.1

func MatchPatterns(str string, rules []string) bool

func NewDialByConf added in v0.27.0

func NewDialByConf(conf *ProxyChannelConfig, scheme string) func(network, addr string) (net.Conn, error)

func NewHTTPClient added in v0.26.3

func NewHTTPClient(conf *ProxyChannelConfig, scheme string) (*http.Client, error)

func NewTLSConfig added in v0.27.2

func NewTLSConfig(conf *ProxyChannelConfig) *tls.Config

func RegisterProxyType added in v0.24.1

func RegisterProxyType(str string, p Proxy) error

func Start

func Start(options ProxyOptions) error

func StartProxy added in v0.29.0

func StartProxy() error

func Stop

func Stop() error

func SyncConfig

func SyncConfig(addr string, localDir string) (bool, error)

Types

type AdminConfig

type AdminConfig struct {
	Listen        string
	BroadcastAddr string
	ConfigDir     string
}

type CipherConfig added in v0.27.0

type CipherConfig struct {
	Method string
	Key    string
}

type GFWListConfig added in v0.26.0

type GFWListConfig struct {
	URL      string
	UserRule []string
	Proxy    string
}

type HTTPBaseConfig added in v0.27.0

type HTTPBaseConfig struct {
	HTTPPushRateLimitPerSec int
}

type HTTPConfig added in v0.27.0

type HTTPConfig struct {
	HTTPBaseConfig
}

func (*HTTPConfig) UnmarshalJSON added in v0.27.0

func (hcfg *HTTPConfig) UnmarshalJSON(data []byte) error

type KCPBaseConfig added in v0.27.0

type KCPBaseConfig struct {
	Mode         string
	Conn         int
	AutoExpire   int
	ScavengeTTL  int
	MTU          int
	SndWnd       int
	RcvWnd       int
	DataShard    int
	ParityShard  int
	DSCP         int
	AckNodelay   bool
	NoDelay      int
	Interval     int
	Resend       int
	NoCongestion int
	SockBuf      int
}

type KCPConfig added in v0.27.0

type KCPConfig struct {
	KCPBaseConfig
}

func (*KCPConfig) UnmarshalJSON added in v0.27.0

func (kcfg *KCPConfig) UnmarshalJSON(data []byte) error

type LocalConfig

type LocalConfig struct {
	Log             []string
	Cipher          CipherConfig
	UserAgent       string
	User            string
	LocalDNS        LocalDNSConfig
	RemoteDNS       RemoteDNSConfig
	UDPGW           UDPGWConfig
	SNI             SNIConfig
	Admin           AdminConfig
	GFWList         GFWListConfig
	TransparentMark int
	Proxy           []ProxyConfig
	Channel         []ProxyChannelConfig
}
var GConf LocalConfig

type LocalDNSConfig

type LocalDNSConfig struct {
	Listen     string
	TrustedDNS []string
	FastDNS    []string
}

type PACConfig

type PACConfig struct {
	Method   []string
	Host     []string
	URL      []string
	Rule     []string
	Protocol []string
	Remote   string
}

func (*PACConfig) Match

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

type Proxy

type Proxy interface {
	//PrintStat(w io.Writer)
	CreateMuxSession(server string, conf *ProxyChannelConfig) (mux.MuxSession, error)
	Features() ProxyFeatureSet
}

type ProxyChannelConfig added in v0.24.1

type ProxyChannelConfig struct {
	Enable              bool
	Name                string
	ServerList          []string
	ConnsPerServer      int
	SNI                 []string
	SNIProxy            string
	Proxy               string
	DialTimeout         int
	ReadTimeout         int
	ReconnectPeriod     int
	HeartBeatPeriod     int
	RCPRandomAdjustment int
	Compressor          string
	KCP                 KCPConfig
	HTTP                HTTPConfig
	// contains filtered or unexported fields
}

func (*ProxyChannelConfig) ProxyURL added in v0.26.0

func (c *ProxyChannelConfig) ProxyURL() *url.URL

type ProxyConfig

type ProxyConfig struct {
	Local            string
	DNSReadMSTimeout int
	UDPReadMSTimeout int
	PAC              []PACConfig
}

type ProxyFeatureSet added in v0.27.0

type ProxyFeatureSet struct {
	AutoExpire bool
	Pingable   bool
}

type ProxyOptions added in v0.28.0

type ProxyOptions struct {
	Config    string
	Hosts     string
	CNIP      string
	Home      string
	WatchConf bool
}

type RemoteDNSConfig added in v0.28.0

type RemoteDNSConfig struct {
	TrustedDNS []string
}

type SNIConfig added in v0.27.2

type SNIConfig struct {
	Redirect map[string]string
}

type UDPGWConfig added in v0.27.2

type UDPGWConfig struct {
	Addr string
}

Jump to

Keyboard shortcuts

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