Versions in this module Expand all Collapse all v1 v1.4.1 Dec 24, 2021 Changes in this version + const AddrMask + const AddressDomainName + const AddressIPv4 + const AddressIPv6 + const DEFAULT_TIMEOUT + const NORMAL_SCAN_DIR + var AutoMap map[string][]ConfigSpeed + var BGCOLORS = []func(a ...interface{}) string + var BOOK Book = Book + var CRY_LEN = 4096 + var DEFAULT_RESOLEVER = DNSResolver + var END_BYTES = []byte + var ErrUDPFragmentNoSupported = errors.New("") + var FGCOLORS = []func(a ...interface{}) string + var GloballeakyBuf = NewLeakyBuf(maxNBuf, leakyBufSize) + var HOME = os.UserHomeDir() + var IconData []byte = []byte + var NORMAL_CONFIG_ROOT = filepath.Join(HOME, "Desktop", "routes") + var NORMAL_OPTIMISE_FILE = filepath.Join(HOME, "Desktop", "route.map.json") + var PASWD = "dGxzOi0tLS0tQkVHSU4gQ0VSVElGSUNBVEUtLS0tLQpNSUlFdURDQ0E2Q2dBd0lCQWdLQ0FRQXVsSEcvUHNKUmVIVWJuelh3SVU2MDlOb1lBZVU4OXFLOVp1WVpZZllrCjVJRHNGZnZlaWV6aGcvM0tndTl3cVdsZFdreHgxMjV6LzdNOXQrMDI2T0c2WkZFTG5sb0U2UmZ2K1RFMmV0bC8Kd3VsZTh2Q0xhdHZRUVp4cnhxQ1FxZHpEZTZiUmsralgyQ2dVRzR2Qy9wUEJFaXZVZ2RTbUJEUTRoVFRiSzlVOQpWbm04QkhqV0JkMVJOdU1BYk9iekJCd0RTZmZJL1RzVWVTUHhHcXA2MFJuZXJxbXFpSWloUHpldVdrcXBZbjBvCk4rTFlHb2hmZGdjYnREeVVVZ0xIelc1RFJFdndDblpORnVNWkJxdEp0N2tkbE5xeWkxaHMvaUk0LzZEV3NBQUYKanQ1UnkySHNXN2NhQm1Ma2lIVjh2aWdxOEh3SXVwbDVVdmpXSXNuT3pLcytNQTBHQ1NxR1NJYjNEUUVCQ3dVQQpNR1V4Q3pBSkJnTlZCQVlUQWtwUU1RNHdEQVlEVlFRSUV3VlViMn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lZaVWcKT0poV0lLQzluUUtCZ0hMT09xVFljQklTUjQydUhUeHkwaVVONVNEQUxwakxxMlFWMzI5MnlidkJMdU1lRWg2TAp1bXU5TVNDd3NCYndOU0RGdDYvM3pSKzdPd1RhSHVJc0FrSHc4UHJLK1NKYjVQWVRiZjRHN0pIN2FKMTB4UmF5CnJiM0ZHWk1lWG1WZEgwZldCUlR5dXNtV1ROQndLaXduOC9xK1BnblhFTkJPNk5HZkl1TSt5djUzQW9HQVdZQXgKcVFxWC9EWHFsRVljd3VOcHE0TlF5NjZwQndDTWNNMWpqTU1QTHFCVGZsWFVHdmtqRHYwcFY2NDc3ZWJ6aGVsTwpvcVBhZisvcFk5K1FzQ2NOSTlDWTQ2WTg3SjU2T1o4ckNjYzA1aVFOYmh1SEVhRVU2ZUdveEVFTjZMQXRkVzR2ClRWM2liQWFUdjN0TTZKZkg4U1JWSjFrMTB4Qm95TzJRdnQxWFBuVUNnWUJZUmFreUFMNlNxWVNwbWRldHg0TUEKRElRMDAyTVZyUFhrVyt2QmZwak1SUDRpNmRIdmNnR0tMWTBzM21uV3pqYkV5UmJPSENiUUpNTHdUQlVaS1kwNQpyeWtDMS9mc3lURm1wSU5yRHNQVWtkeVAwTWVWa1MvYTNuOWNxYTFOUWpBZ2E0aGFRdEt5N2ZtamVPeHdjcGIyCmJKbU02WXF6a1R3TG51bHR1MlFIQ3c9PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCkAwLjAuMC4wOjEyMzQ1" + var ProxyAddr = "127.0.0.1:1091" + var RouteIsBroken = errors.New("Route is broken. can not connect to outer world!") + var SALT = "demo salt" + var SocksConnectBroken = errors.New("Socks5 connect Error!") + var SpeedMsgCHANNEL = make(chan Statistic, 30) + var TODAY time.Time = time.Now() + var TestProxyAddr = "127.0.0.1:40086" + var Tmp = os.TempDir() + func ColorD(args interface{}, join ...string) + func ColorE(args ...interface{}) + func ColorL(args ...interface{}) + func ColorM(args ...interface{}) + func Copy(dst io.Writer, src io.Reader) (written int64, err error) + func CreateCertificate(serverHost string, isCA bool) (configUri, base string) + func Credient(username, password string) (routeDir string, err error) + func DeepCopy(dst interface{}, src interface{}) + func DialWithRawAddr(rawaddr []byte, server string) (conn net.Conn, err error) + func DownloadFile(filepath string, url string) error + func GbkToUtf8(s []byte) ([]byte, error) + func GenerateConfigJsons(dstRoot string) (err error) + func GetLocalRequest(conn *net.Conn) (rawaddr []byte, host string, isUdp bool, err error) + func GetLocalRequestUDP(conn *net.Conn) (rawaddr []byte, host string, err error) + func GetMainDomain(urlOrHost string) string + func GetOldSpeedMap(filepath string) (out map[string][]ConfigSpeed) + func GetSSServerRequest(conn net.Conn) (host string, raw []byte, isUdp bool, err error) + func GetServerRequest(conn net.Conn) (host string, raw []byte, isUdp bool, err error) + func HostToRaw(host string, port int) (raw []byte) + func IsDir(path string) bool + func KillProcess() (err error) + func LogCopy(src, dst net.Conn) + func Md5Str(buf []byte) string + func ParseUDPSocks5(buf []byte) (host string, rawaddr []byte, err error) + func PathExists(path string) bool + func Pipe(p1, p2 net.Conn) (err error) + func PipeThenClose(src, dst CanCopy) + func SendSpeedMsg(ip string, usage int64, speed float64) + func SetConfigS(config *Config, addr string) (err error) + func SetDebug(d DebugLog) + func SetKcpReadTimeout(c *kcp.UDPSession) + func SetReadTimeout(c *net.Conn) + func SetStreamReadTimeout(c *smux.Stream) + func Socks5HandShake(conn *net.Conn) (err error) + func SpeedShow() + func Stat(cmd string, s bool) + func Sync(configRoot string) (file string, err error) + func Tcp2Kcp(src, dst io.ReadWriteCloser) + func Unzip(src string, dest string) ([]string, error) + func UpdateConfig(old, new *Config) + func Utf8ToGbk(s []byte) ([]byte, error) + type AddrSpec struct + FQDN string + IP net.IP + Port int + func (a *AddrSpec) String() string + func (a AddrSpec) Address() string + type Book struct + func NewBook() *Book + func (book *Book) Add(ssuri string) (s string, err error) + func (book *Book) Books() (cons []Config) + func (book *Book) Count() int + func (book *Book) FlowGet() (config *Config) + func (book *Book) Get(server ...string) (config *Config) + func (book *Book) GetServers() (s []string) + func (book *Book) Info() (cs []string, err error) + func (book *Book) Ls() (cs []string, err error) + func (book *Book) RandGet(server ...string) (config *Config) + func (book *Book) Scan(dirs ...string) (dirErr error) + type CanCopy interface + type CanDeadLine interface + SetReadDeadline func(t time.Time) error + type Config struct + EBUFLEN int + LocalAddress string + LocalPort int + Method string + OldSSPwd string + Password string + PortPassword map[string]string + SALT string + SSMethod string + SSPassword string + Server interface{} + ServerPassword string + ServerPort int + Timeout int + func ParseConfig(path string) (config *Config, err error) + func ParseURI(u string) (config *Config) + func (config *Config) GeneratePassword(plugin ...string) (en kcp.BlockCrypt) + func (config *Config) GetBook(key string) (book *Config) + func (config *Config) GetBookByID(id uint16) (book *Config) + func (config *Config) GetServerArray() []string + func (config *Config) ToFile(dst string) (err error) + func (config *Config) ToJson() string + func (config *Config) ToString() string + func (config *Config) ToTlsConfig() (tlsConfig *TlsConfig, err error) + func (config *Config) ToUri() string + type ConfigSpeed struct + Server string + Url string + Used float32 + func TestURLUsedTime(requrl, host string) ConfigSpeed + type DNSResolver struct + func (d DNSResolver) Resolve(ctx context.Context, name string) (context.Context, net.IP, error) + type DebugLog bool + var Debug DebugLog + func (d DebugLog) Printf(format string, args ...interface{}) + func (d DebugLog) Println(args ...interface{}) + type KcpBase struct + IfCompress bool + IsHeartBeat bool + Messages chan string + Numconn int + Plugin string + RedirectBooks map[string]*Route + Role string + func (kcp *KcpBase) HiddenConnListener() + func (kcp *KcpBase) HiidenConfig(con net.Conn) + func (kcp *KcpBase) SetRedirectIRC(man *remote.ApiServerMan, ip string) + func (kcpBase *KcpBase) Activate(do_some func() error) error + func (kcpBase *KcpBase) AddAlive() + func (kcpBase *KcpBase) AddReverseCon() + func (kcpBase *KcpBase) DelReverseCon() + func (kcpBase *KcpBase) GetActivateConn() int + func (kcpBase *KcpBase) GetAliveNum() int + func (kcpBase *KcpBase) GetAliveReverseCon() int + func (kcpBase *KcpBase) GetConfig() *Config + func (kcpBase *KcpBase) GetKcpConfig() *KcpConfig + func (kcpBase *KcpBase) GetRefreshRate() time.Duration + func (kcpBase *KcpBase) GetSession(idx uint16) (session *smux.Session) + func (kcpBase *KcpBase) GetSmuxConfig() *smux.Config + func (kcpBase *KcpBase) HeartBeatC(stream net.Conn) + func (kcpBase *KcpBase) HeartBeatS(stream net.Conn, fromHost string, clearAfter func(h string)) + func (kcpBase *KcpBase) Init(config *Config) + func (kcpBase *KcpBase) Pipe(p1, p2 net.Conn) + func (kcpBase *KcpBase) ReConnection() (session *smux.Session, err error) + func (kcpBase *KcpBase) RecvMsg(filter ...string) (pre string, content string) + func (kcpBase *KcpBase) SendMsg(pre string, content string) + func (kcpBase *KcpBase) SetConfig(config *Config) + func (kcpBase *KcpBase) SetKcpConfig(config *KcpConfig) + func (kcpBase *KcpBase) SetRefreshRate(interval int) + func (kcpBase *KcpBase) SetTunnelNum(n int) int + func (kcpBase *KcpBase) ShowConfig() + func (kcpBase *KcpBase) UpdateConfig(uri string) + func (kcpBase *KcpBase) UpdateKcpConfig(kcpconn *kcp.UDPSession) + func (kcpBase *KcpBase) WaitConn(config *Config) *smux.Session + func (kcpBase *KcpBase) WithSession(config *Config, id ...uint16) (session *smux.Session) + func (kcpBase *KcpBase) WithTestSession(config *Config, howTo func(sess *smux.Session)) + func (s *KcpBase) HandleUDP(udpConn *net.UDPConn) + func (serv *KcpBase) ListenUDP(ip string, port int) + type KcpConfig struct + AckNodelay bool + AutoExpire int + DataShard int + Interval int + KeepAlive int + MTU int + Mode string + NoCongestion int + NoDelay int + ParityShard int + RcvWnd int + Resend int + ScavengeTTL int + SmuxBuf int + SndWnd int + SocketBuf int + StreamBuf int + func (kconfig *KcpConfig) GenerateConfig() *smux.Config + func (kconfig *KcpConfig) SetAsDefault() + func (kconfig *KcpConfig) UpdateMode() + type LeakyBuf struct + func NewLeakyBuf(n, bufSize int) *LeakyBuf + func (lb *LeakyBuf) Get() (b []byte) + func (lb *LeakyBuf) Put(b []byte) + type NameResolver interface + Resolve func(ctx context.Context, name string) (context.Context, net.IP, error) + type Route struct + func NewRoute(cmd string) (route *Route, err error) + func (route *Route) GetConfig() *Config + func (route *Route) Host() string + func (route *Route) IfNoExpired() bool + func (route *Route) Left() int + func (route *Route) Mode() string + func (route *Route) SetConfig(config *Config) + func (route *Route) SetExireTime(sec int) + func (route *Route) SetMode(mode string) + type SpeedBar struct + type SpeedTest struct + SortResults map[string][]ConfigSpeed + func NewSpeedTest() (tester *SpeedTest) + func (test *SpeedTest) FlowMode() (output string, err error) + func (test *SpeedTest) GetHistoryUrls() (history []string, err error) + func (test *SpeedTest) GetNow() (out map[string]string, err error) + func (test *SpeedTest) LsConfig() (output map[string]string, err error) + func (test *SpeedTest) LsRoute() (out string, err error) + func (test *SpeedTest) LsStop() (out string, err error) + func (test *SpeedTest) SetConfig(config *Config) (err error) + func (test *SpeedTest) SetRoute(uri ...string) (output string, err error) + func (test *SpeedTest) ShowConfig(ip string) (output string, err error) + func (test *SpeedTest) TestAllConfigs(howTest func(proaxyaddr string, config Config)) + func (test *SpeedTest) TestOneConfig(config *Config, addr string) + func (test *SpeedTest) TestSpeed(urls []string, dirs ...string) (out map[string][]ConfigSpeed) + type Statistic struct + type TlsConfig struct + Ca x509.CertPool + Cert tls.Certificate + Server string + func UseDefaultTlsConfig(addr string) (tlsConfig *TlsConfig) + func (tlsConfig *TlsConfig) GenerateConfig() (config tls.Config) + func (tlsConfig *TlsConfig) WithConn() (conn *tls.Conn, err error) + func (tlsConfig *TlsConfig) WithTlsListener() (listenr net.Listener, err error) + type UrlSpeed struct