Documentation
¶
Index ¶
- Constants
- func Client(local, remote, obfs, password, mode string) error
- func ClientContext(ctx context.Context, local, remote, obfs, password, mode string, ...) error
- func CreateAuth(encrytype string, passwd string) (socks5Auth, error)
- func SecureCopy(src io.ReadWriteCloser, dst io.ReadWriteCloser, secure func(b []byte) error) (written int64, err error)
- func Server(local, obfs, password string) error
- func ServerContext(ctx context.Context, local, obfs, password string, options ProxyOptions) error
- type DefaultAuth
- type Protocol
- type ProtocolVersion
- type ProxyOptions
- type Socks5AuthUPasswd
- type Socks5Resolution
Constants ¶
View Source
const ( RANDOM_A = 13 RANDOM_B = 7 RANDOM_M = 256 )
View Source
const ( SOCKS_VERSION = 0x05 METHOD_CODE = 0x00 )
Variables ¶
This section is empty.
Functions ¶
func ClientContext ¶
func ClientContext(ctx context.Context, local, remote, obfs, password, mode string, options ProxyOptions) error
ClientContext serves an HTTP or SOCKS5 application proxy until cancellation.
func CreateAuth ¶
创建流量混淆器。当前实现不是安全通道。
func SecureCopy ¶
func SecureCopy(src io.ReadWriteCloser, dst io.ReadWriteCloser, secure func(b []byte) error) (written int64, err error)
SecureCopy 对有效负载做流量混淆后再转发。
func ServerContext ¶
func ServerContext(ctx context.Context, local, obfs, password string, options ProxyOptions) error
ServerContext serves the obfuscated SOCKS proxy until cancellation.
Types ¶
type DefaultAuth ¶
func CreateRandomCipher ¶
func CreateRandomCipher(passwd string) (*DefaultAuth, error)
func CreateSimpleCipher ¶
func CreateSimpleCipher(passwd string) (*DefaultAuth, error)
func (*DefaultAuth) DecodeRead ¶
func (s *DefaultAuth) DecodeRead(c io.ReadWriter, b []byte) (int, error)
func (*DefaultAuth) Decrypt ¶
func (s *DefaultAuth) Decrypt(b []byte) error
func (*DefaultAuth) EncodeWrite ¶
func (s *DefaultAuth) EncodeWrite(c io.ReadWriter, b []byte) (int, error)
func (*DefaultAuth) Encrypt ¶
func (s *DefaultAuth) Encrypt(b []byte) error
type ProtocolVersion ¶
*
The localConn connects to the dstServer, and sends a ver
identifier/method selection message:
+----+----------+----------+
|VER | NMETHODS | METHODS |
+----+----------+----------+
| 1 | 1 | 1 to 255 |
+----+----------+----------+
The VER field is set to X'05' for this ver of the protocol. The
NMETHODS field contains the number of method identifier octets that
appear in the METHODS field.
METHODS常见的几种方式如下:
1>.数字“0”:表示不需要用户名或者密码验证;
2>.数字“1”:GSSAPI是SSH支持的一种验证方式;
3>.数字“2”:表示需要用户名和密码进行验证;
4>.数字“3”至“7F”:表示用于IANA 分配(IANA ASSIGNED)
5>.数字“80”至“FE”表示私人方法保留(RESERVED FOR PRIVATE METHODS)
4>.数字“FF”:不支持所有的验证方式,无法进行连接
*
func (*ProtocolVersion) HandleHandshake ¶
func (s *ProtocolVersion) HandleHandshake(b []byte) ([]byte, error)
func (*ProtocolVersion) SentHandshake ¶
func (s *ProtocolVersion) SentHandshake(conn net.Conn) error
type ProxyOptions ¶
type ProxyOptions struct {
MaxConnections int
DialTimeout time.Duration
HandshakeTimeout time.Duration
IdleTimeout time.Duration
}
ProxyOptions bounds resource use in application proxy mode. Zero selects the default; negative values are rejected. IdleTimeout measures either direction.
type Socks5AuthUPasswd ¶
func (*Socks5AuthUPasswd) HandleAuth ¶
func (s *Socks5AuthUPasswd) HandleAuth(b []byte) ([]byte, error)
type Socks5Resolution ¶
type Socks5Resolution struct {
VER uint8
CMD uint8
RSV uint8
ATYP uint8
DSTADDR []byte
DSTPORT uint16
DSTDOMAIN string
RAWADDR *net.TCPAddr
}
*
结构:
+----+-----+-------+------+----------+----------+
|VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
+----+-----+-------+------+----------+----------+
| 1 | 1 | X'00' | 1 | Variable | 2 |
+----+-----+-------+------+----------+----------+
cmd代表客户端请求的类型,值长度也是1个字节,有三种类型:
1>.数字“1”:表示客户端需要你帮忙代理连接,即CONNECT ;
2>.数字“2”:表示让你代理服务器,帮他建立端口,即BIND ;
3>.数字“3”:表示UDP连接请求用来建立一个在UDP延迟过程中操作UDP数据报的连接,即UDP ASSOCIATE;
ATYP代表请求的远程服务器地址类型,它是一个可变参数,但是它值的长度1个字节,
有三种类型:
1>.数字“1”:表示是一个IPV4地址(IP V4 address);
2>.数字“3”:表示是一个域名(DOMAINNAME);
3>.数字“4”:表示是一个IPV6地址(IP V6 address);
*
func (*Socks5Resolution) LSTRequest ¶
func (s *Socks5Resolution) LSTRequest(b []byte) ([]byte, error)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
client
command
|
|
|
server
command
|
|
|
internal
|
|
|
tunnel/session
Package session provides authentication shared by desktop and mobile clients.
|
Package session provides authentication shared by desktop and mobile clients. |
|
tunnel/testutil
Package testutil supplies local-only TLS fixtures for tunnel tests.
|
Package testutil supplies local-only TLS fixtures for tunnel tests. |
|
Package mobile is the gomobile-compatible IPv4 tunnel client.
|
Package mobile is the gomobile-compatible IPv4 tunnel client. |
Click to show internal directories.
Click to hide internal directories.