Documentation ¶
Overview ¶
Provides leaky buffer, based on the example in Effective Go.
Index ¶
- Constants
- Variables
- func BuildBytesPacket(packetType uint8, data ...[]byte) []byte
- func BuildPacket(packetType uint8, data ...string) []byte
- func BuildPacketBytes(data ...[]byte) []byte
- func BuildPacketData(data ...string) []byte
- func CloseConn(conn *net.Conn)
- func ConnectHost(hostAndPort string, timeout int) (conn net.Conn, err error)
- func ConnectKCPHost(hostAndPort string, config kcpcfg.KCPConfigArgs) (conn net.Conn, err error)
- func GetAllInterfaceAddr() ([]net.IP, error)
- func GetKCPBlock(method, key string) (block kcp.BlockCrypt)
- func HTTPGet(URL string, timeout int) (err error)
- func HttpGet(URL string, timeout int, host ...string) (body []byte, code int, err error)
- func InsertProxyHeaders(head []byte, headers string) []byte
- func IoBind(dst io.ReadWriteCloser, src io.ReadWriteCloser, fn func(err interface{}), ...)
- func IoBindNoClose(dst io.ReadWriteCloser, src io.ReadWriteCloser, fn func(err interface{}), ...)
- func IsHTTP(head []byte) bool
- func IsInternalIP(domainOrIP string, always bool) bool
- func IsNetClosedErr(err error) bool
- func IsNetDeadlineErr(err error) bool
- func IsNetRefusedErr(err error) bool
- func IsNetSocketNotConnectedErr(err error) bool
- func IsNetTimeoutErr(err error) bool
- func IsSocks5(head []byte) bool
- func LBMethod(key string) int
- func LookupIP(host string) ([]net.IP, error)
- func NewCompConn(conn net.Conn) net.Conn
- func NewDefaultLogger() *logger.Logger
- func PathExists(_path string) bool
- func RandInt(strLen int) int64
- func RandString(strlen int) string
- func ReadBytes(r io.Reader) (data []byte, err error)
- func ReadBytesPacket(r io.Reader, packetType *uint8, data ...*[]byte) (err error)
- func ReadData(r io.Reader) (data string, err error)
- func ReadPacket(r io.Reader, packetType *uint8, data ...*string) (err error)
- func ReadPacketBytes(r io.Reader, data ...*[]byte) (err error)
- func ReadPacketData(r io.Reader, data ...*string) (err error)
- func ReadUDPPacket(_reader io.Reader) (srcAddr string, packet []byte, err error)
- func RemoveProxyHeaders(head []byte) []byte
- func SingleTlsConfig(caCertBytes []byte) (conf *tls.Config, err error)
- func SingleTlsConnect(host string, port, timeout int, caCertBytes []byte) (conn tls.Conn, err error)
- func SingleTlsConnectHost(host string, timeout int, caCertBytes []byte) (conn tls.Conn, err error)
- func SubBytes(bytes []byte, start, end int) []byte
- func SubStr(str string, start, end int) string
- func TlsBytes(cert, key string) (certBytes, keyBytes []byte, err error)
- func TlsConfig(certBytes, keyBytes, caCertBytes []byte) (conf *tls.Config, err error)
- func TlsConnect(host string, port, timeout int, certBytes, keyBytes, caCertBytes []byte) (conn tls.Conn, err error)
- func TlsConnectHost(host string, timeout int, certBytes, keyBytes, caCertBytes []byte) (conn tls.Conn, err error)
- func UDPCopy(dst, src *net.UDPConn, dstAddr net.Addr, readTimeout time.Duration, ...)
- func UDPPacket(srcAddr string, packet []byte) []byte
- func Uniqueid() string
- type BasicAuth
- func (ba *BasicAuth) Add(userpassArr []string) (n int)
- func (ba *BasicAuth) AddFromFile(file string) (n int, err error)
- func (ba *BasicAuth) Check(userpass string, userIP, localIP, target string) (ok bool)
- func (ba *BasicAuth) CheckUserPass(user, pass, userIP, localIP, target string) (ok bool)
- func (ba *BasicAuth) Delete(userArr []string)
- func (ba *BasicAuth) SetAuthURL(URL string, code, timeout, retry int)
- func (ba *BasicAuth) Total() (n int)
- type BufferedConn
- type Checker
- type CheckerItem
- type ClientKeyRouter
- type CompStream
- func (c *CompStream) Close() error
- func (c *CompStream) LocalAddr() net.Addr
- func (c *CompStream) Read(p []byte) (n int, err error)
- func (c *CompStream) RemoteAddr() net.Addr
- func (c *CompStream) SetDeadline(t time.Time) error
- func (c *CompStream) SetReadDeadline(t time.Time) error
- func (c *CompStream) SetWriteDeadline(t time.Time) error
- func (c *CompStream) Write(p []byte) (n int, err error)
- type ConnManager
- type HTTPRequest
- type LeakyBuf
Constants ¶
View Source
const LeakyBufSize = 2048 // data.len(2) + hmacsha1(10) + data(4096)
Variables ¶
View Source
var LeakyBuffer = NewLeakyBuf(maxNBuf, LeakyBufSize)
Functions ¶
func BuildBytesPacket ¶
func BuildPacket ¶
func BuildPacketBytes ¶
func BuildPacketData ¶
func ConnectKCPHost ¶
func GetAllInterfaceAddr ¶
func GetKCPBlock ¶
func GetKCPBlock(method, key string) (block kcp.BlockCrypt)
func InsertProxyHeaders ¶
func IoBind ¶
func IoBind(dst io.ReadWriteCloser, src io.ReadWriteCloser, fn func(err interface{}), log *logger.Logger)
func IoBindNoClose ¶
func IoBindNoClose(dst io.ReadWriteCloser, src io.ReadWriteCloser, fn func(err interface{}), log *logger.Logger)
func IsInternalIP ¶
func IsNetClosedErr ¶
func IsNetDeadlineErr ¶
func IsNetRefusedErr ¶
func IsNetTimeoutErr ¶
func NewDefaultLogger ¶
func PathExists ¶
func RandString ¶
func ReadBytesPacket ¶
typed packet with bytes
func ReadPacket ¶
typed packet with string
func ReadPacketBytes ¶
non typed packet with Bytes
func ReadPacketData ¶
non typed packet with string
func ReadUDPPacket ¶
func RemoveProxyHeaders ¶
func SingleTlsConnect ¶
func SingleTlsConnectHost ¶
func TlsConnect ¶
func TlsConnectHost ¶
Types ¶
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
func NewBasicAuth ¶
func NewBasicAuth(dns *dnsx.DomainResolver, log *logger.Logger) BasicAuth
func (*BasicAuth) CheckUserPass ¶
func (*BasicAuth) SetAuthURL ¶
type BufferedConn ¶
type BufferedConn struct { net.Conn // So that most methods are embedded // contains filtered or unexported fields }
func NewBufferedConn ¶
func NewBufferedConn(c net.Conn) BufferedConn
func NewBufferedConnSize ¶
func NewBufferedConnSize(c net.Conn, n int) BufferedConn
func (BufferedConn) Buffered ¶
func (b BufferedConn) Buffered() int
func (BufferedConn) ReadByte ¶
func (b BufferedConn) ReadByte() (byte, error)
func (BufferedConn) UnreadByte ¶
func (b BufferedConn) UnreadByte() error
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewChecker ¶
func NewChecker(timeout int, interval int64, blockedFile, directFile string, log *logger.Logger, intelligent string) Checker
NewChecker args: timeout : tcp timeout milliseconds ,connect to host interval: recheck domain interval seconds
type CheckerItem ¶
type ClientKeyRouter ¶
type ClientKeyRouter struct {
// contains filtered or unexported fields
}
func NewClientKeyRouter ¶
func NewClientKeyRouter(ctrl *mapx.ConcurrentMap, size int) ClientKeyRouter
func (*ClientKeyRouter) GetKey ¶
func (c *ClientKeyRouter) GetKey() string
type CompStream ¶
func NewCompStream ¶
func NewCompStream(conn net.Conn) *CompStream
func (*CompStream) Close ¶
func (c *CompStream) Close() error
func (*CompStream) LocalAddr ¶
func (c *CompStream) LocalAddr() net.Addr
func (*CompStream) RemoteAddr ¶
func (c *CompStream) RemoteAddr() net.Addr
func (*CompStream) SetDeadline ¶
func (c *CompStream) SetDeadline(t time.Time) error
func (*CompStream) SetReadDeadline ¶
func (c *CompStream) SetReadDeadline(t time.Time) error
func (*CompStream) SetWriteDeadline ¶
func (c *CompStream) SetWriteDeadline(t time.Time) error
type ConnManager ¶
type ConnManager struct {
// contains filtered or unexported fields
}
func NewConnManager ¶
func NewConnManager(log *logger.Logger) ConnManager
func (*ConnManager) Remove ¶
func (cm *ConnManager) Remove(key string)
func (*ConnManager) RemoveAll ¶
func (cm *ConnManager) RemoveAll()
func (*ConnManager) RemoveOne ¶
func (cm *ConnManager) RemoveOne(key string, ID string)
type HTTPRequest ¶
type HTTPRequest struct { HeadBuf []byte Host string Method string URL string IsSNI bool // contains filtered or unexported fields }
func NewHTTPRequest ¶
func (*HTTPRequest) BasicAuth ¶
func (req *HTTPRequest) BasicAuth() (err error)
func (*HTTPRequest) GetAuthDataStr ¶
func (req *HTTPRequest) GetAuthDataStr() (basicInfo string, err error)
func (*HTTPRequest) HTTP ¶
func (req *HTTPRequest) HTTP() (err error)
func (*HTTPRequest) HTTPS ¶
func (req *HTTPRequest) HTTPS() (err error)
func (*HTTPRequest) HTTPSReply ¶
func (req *HTTPRequest) HTTPSReply() (err error)
func (*HTTPRequest) IsHTTPS ¶
func (req *HTTPRequest) IsHTTPS() bool
Click to show internal directories.
Click to hide internal directories.