Documentation ¶
Overview ¶
*
- Created with IntelliJ IDEA.
- User: clowwindy
- Date: 12-11-2
- Time: 上午10:31
- To change this template use File | Settings | File Templates.
Provides leaky buffer, based on the example in Effective Go.
Index ¶
- Constants
- Variables
- func CheckCipherMethod(method string) error
- func HmacSha1(key []byte, data []byte) []byte
- func IsFileExists(path string) (bool, error)
- func PipeThenClose(src, dst net.Conn, addTraffic func(int))
- func Pipeloop(write net.PacketConn, writeAddr net.Addr, readClose net.PacketConn, ...)
- func PrintVersion()
- func RawAddr(addr string) (buf []byte, err error)
- func ReadAndHandleUDPReq(c *SecurePacketConn, addTraffic func(int)) error
- func SetDebug(d DebugLog)
- func SetReadTimeout(c net.Conn)
- func UpdateConfig(old, new *Config)
- type Cipher
- type ClosedFlag
- type Config
- type Conn
- type DebugLog
- type DecOrEnc
- type Dialer
- type LeakyBuf
- type ProxyAddr
- type ProxyConn
- type SecurePacketConn
- func (c *SecurePacketConn) Close() error
- func (c *SecurePacketConn) LocalAddr() net.Addr
- func (c *SecurePacketConn) ReadFrom(b []byte) (n int, src net.Addr, err error)
- func (c *SecurePacketConn) SetDeadline(t time.Time) error
- func (c *SecurePacketConn) SetReadDeadline(t time.Time) error
- func (c *SecurePacketConn) SetWriteDeadline(t time.Time) error
- func (c *SecurePacketConn) WriteTo(b []byte, dst net.Addr) (n int, err error)
Constants ¶
View Source
const (
AddrMask byte = 0xf
)
Variables ¶
View Source
var ErrNilCipher = errors.New("cipher can't be nil")
Functions ¶
func CheckCipherMethod ¶
func IsFileExists ¶
func PipeThenClose ¶
PipeThenClose copies data from src to dst, closes dst when done.
func Pipeloop ¶
func Pipeloop(write net.PacketConn, writeAddr net.Addr, readClose net.PacketConn, addTraffic func(int))
func PrintVersion ¶
func PrintVersion()
func ReadAndHandleUDPReq ¶
func ReadAndHandleUDPReq(c *SecurePacketConn, addTraffic func(int)) error
func SetReadTimeout ¶
func UpdateConfig ¶
func UpdateConfig(old, new *Config)
Useful for command line to override options specified in config file Debug is not updated.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
type ClosedFlag ¶
type ClosedFlag struct {
// contains filtered or unexported fields
}
func (*ClosedFlag) IsClosed ¶
func (flag *ClosedFlag) IsClosed() bool
func (*ClosedFlag) SetClosed ¶
func (flag *ClosedFlag) SetClosed()
type Config ¶
type Config struct { Server interface{} `json:"server"` ServerPort int `json:"server_port"` LocalPort int `json:"local_port"` LocalAddress string `json:"local_address"` Password string `json:"password"` Method string `json:"method"` // encryption method // following options are only used by server PortPassword map[string]string `json:"port_password"` Timeout int `json:"timeout"` // The order of servers in the client config is significant, so use array // instead of map to preserve the order. ServerPassword [][]string `json:"server_password"` }
func ParseConfig ¶
func (*Config) GetServerArray ¶
type Conn ¶
func DialWithRawAddr ¶
This is intended for use by users implementing a local socks proxy. rawaddr shoud contain part of the data in socks request, starting from the ATYP field. (Refer to rfc1928 for more information.)
type LeakyBuf ¶
type LeakyBuf struct {
// contains filtered or unexported fields
}
func NewLeakyBuf ¶
NewLeakyBuf creates a leaky buffer which can hold at most n buffer, each with bufSize bytes.
type ProxyConn ¶
type ProxyConn struct { *Conn // contains filtered or unexported fields }
func (*ProxyConn) RemoteAddr ¶
type SecurePacketConn ¶
type SecurePacketConn struct { net.PacketConn *Cipher }
func NewSecurePacketConn ¶
func NewSecurePacketConn(c net.PacketConn, cipher *Cipher) *SecurePacketConn
func (*SecurePacketConn) Close ¶
func (c *SecurePacketConn) Close() error
func (*SecurePacketConn) LocalAddr ¶
func (c *SecurePacketConn) LocalAddr() net.Addr
func (*SecurePacketConn) SetDeadline ¶
func (c *SecurePacketConn) SetDeadline(t time.Time) error
func (*SecurePacketConn) SetReadDeadline ¶
func (c *SecurePacketConn) SetReadDeadline(t time.Time) error
func (*SecurePacketConn) SetWriteDeadline ¶
func (c *SecurePacketConn) SetWriteDeadline(t time.Time) error
Click to show internal directories.
Click to hide internal directories.