channel

package
v0.0.0-...-3fdcba8 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: BSD-3-Clause Imports: 27 Imported by: 11

Documentation

Index

Constants

View Source
const DirectChannelName = "direct"
View Source
const Version = "0.34.0"

Variables

View Source
var DirectSchemes = []string{
	DirectChannelName,
	"socks",
	"socks4",
	"socks5",
	"http_proxy",
}
View Source
var ErrNotSupportedOperation = errors.New("Not supported operation")
View Source
var LocalChannelTypeTable map[string]reflect.Type = make(map[string]reflect.Type)
View Source
var UPNPExposePort int

Functions

func AllowedSchema

func AllowedSchema() []string

func DialServerByConf

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

func DumpLoaclChannelStat

func DumpLoaclChannelStat(w io.Writer)

func InitialPMuxConfig

func InitialPMuxConfig(cipher *CipherConfig) *pmux.Config

func IsDirectScheme

func IsDirectScheme(scheme string) bool

func NewDialByConf

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

func NewHTTPClient

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

func NewTLSConfig

func NewTLSConfig(conf *ProxyChannelConfig) *tls.Config

func RegisterLocalChannelType

func RegisterLocalChannelType(str string, p LocalChannel) error

func ServProxyMuxSession

func ServProxyMuxSession(session mux.MuxSession, auth *mux.AuthRequest, raddr net.Addr) error

func SetDefaultMuxConfig

func SetDefaultMuxConfig(cfg MuxConfig)

func SetDefaultProxyLimitConfig

func SetDefaultProxyLimitConfig(cfg ProxyLimitConfig)

func StopLocalChannels

func StopLocalChannels()

Types

type CipherConfig

type CipherConfig struct {
	User   string
	Method string
	Key    string
	// contains filtered or unexported fields
}
var DefaultServerCipher CipherConfig

func (*CipherConfig) Adjust

func (conf *CipherConfig) Adjust()

func (*CipherConfig) AllowUsers

func (conf *CipherConfig) AllowUsers(users string)

func (*CipherConfig) VerifyUser

func (conf *CipherConfig) VerifyUser(user string) bool

type DeadLineAccetor

type DeadLineAccetor interface {
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
}

type FeatureSet

type FeatureSet struct {
	AutoExpire bool
	Pingable   bool
}

type HTTPBaseConfig

type HTTPBaseConfig struct {
	HTTPPushRateLimitPerSec int
	UserAgent               string
	ReadTimeout             int
}

type HTTPConfig

type HTTPConfig struct {
	HTTPBaseConfig
}

func (*HTTPConfig) UnmarshalJSON

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

type HopServers

type HopServers []string

func (*HopServers) Set

func (i *HopServers) Set(value string) error

func (*HopServers) String

func (i *HopServers) String() string

type KCPBaseConfig

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
}

func (*KCPBaseConfig) InitDefaultConf

func (kcfg *KCPBaseConfig) InitDefaultConf()

type KCPConfig

type KCPConfig struct {
	KCPBaseConfig
}

func (*KCPConfig) UnmarshalJSON

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

type LocalChannel

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

type LocalProxyChannel

type LocalProxyChannel struct {
	Conf ProxyChannelConfig
	// contains filtered or unexported fields
}

func NewProxyChannel

func NewProxyChannel(conf *ProxyChannelConfig) *LocalProxyChannel

func (*LocalProxyChannel) Init

func (ch *LocalProxyChannel) Init(lock bool) bool

type MuxConfig

type MuxConfig struct {
	MaxStreamWindow    string
	StreamMinRefresh   string
	StreamIdleTimeout  int
	SessionIdleTimeout int
	UpBufferSize       int
	DownBufferSize     int
}

func (*MuxConfig) ToPMuxConf

func (m *MuxConfig) ToPMuxConf() *pmux.Config

type ProxyChannelConfig

type ProxyChannelConfig struct {
	Enable                 bool
	Name                   string
	ServerList             []string
	ConnsPerServer         int
	SNI                    []string
	SNIProxy               string
	Proxy                  string
	RemoteDialMSTimeout    int
	RemoteDNSReadMSTimeout int
	RemoteUDPReadMSTimeout int
	LocalDialMSTimeout     int
	ReconnectPeriod        int
	HeartBeatPeriod        int
	RCPRandomAdjustment    int
	Compressor             string
	KCP                    KCPConfig
	HTTP                   HTTPConfig
	Cipher                 CipherConfig
	Hops                   HopServers
	RemoteSNIProxy         map[string]string
	HibernateAfterSecs     int
	P2PToken               string
	P2S2PEnable            bool
	// contains filtered or unexported fields
}

func GetMuxStreamByChannel

func GetMuxStreamByChannel(name string) (mux.MuxStream, *ProxyChannelConfig, error)

func GetMuxStreamByURL

func GetMuxStreamByURL(u *url.URL, defaultUser string, defaultCipher *CipherConfig) (mux.MuxStream, *ProxyChannelConfig, error)

func (*ProxyChannelConfig) Adjust

func (conf *ProxyChannelConfig) Adjust()

func (*ProxyChannelConfig) GetRemoteSNI

func (conf *ProxyChannelConfig) GetRemoteSNI(domain string) string

func (*ProxyChannelConfig) ProxyURL

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

type ProxyLimitConfig

type ProxyLimitConfig struct {
	WhiteList []string
	BlackList []string
}

func (*ProxyLimitConfig) Allowed

func (limit *ProxyLimitConfig) Allowed(host string) bool

type RateLimitConfig

type RateLimitConfig struct {
	Limit map[string]string
}
var DefaultServerRateLimit RateLimitConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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