Debian Codegraph @

socks5.go

raw symbols SCIP
1 package socks5
2
3 const (
4 // Ver is socks protocol version
5 Ver byte = 0x05
6
7 // MethodNone is none method
8 MethodNone byte = 0x00
9 // MethodGSSAPI is gssapi method
10 MethodGSSAPI byte = 0x01 // MUST support // todo
11 // MethodUsernamePassword is username/assword auth method
12 MethodUsernamePassword byte = 0x02 // SHOULD support
13 // MethodUnsupportAll means unsupport all given methods
14 MethodUnsupportAll byte = 0xFF
15
16 // UserPassVer is username/password auth protocol version
17 UserPassVer byte = 0x01
18 // UserPassStatusSuccess is success status of username/password auth
19 UserPassStatusSuccess byte = 0x00
20 // UserPassStatusFailure is failure status of username/password auth
21 UserPassStatusFailure byte = 0x01 // just other than 0x00
22
23 // CmdConnect is connect command
24 CmdConnect byte = 0x01
25 // CmdBind is bind command
26 CmdBind byte = 0x02
27 // CmdUDP is UDP command
28 CmdUDP byte = 0x03
29
30 // ATYPIPv4 is ipv4 address type
31 ATYPIPv4 byte = 0x01 // 4 octets
32 // ATYPDomain is domain address type
33 ATYPDomain byte = 0x03 // The first octet of the address field contains the number of octets of name that follow, there is no terminating NUL octet.
34 // ATYPIPv6 is ipv6 address type
35 ATYPIPv6 byte = 0x04 // 16 octets
36
37 // RepSuccess means that success for repling
38 RepSuccess byte = 0x00
39 // RepServerFailure means the server failure
40 RepServerFailure byte = 0x01
41 // RepNotAllowed means the request not allowed
42 RepNotAllowed byte = 0x02
43 // RepNetworkUnreachable means the network unreachable
44 RepNetworkUnreachable byte = 0x03
45 // RepHostUnreachable means the host unreachable
46 RepHostUnreachable byte = 0x04
47 // RepConnectionRefused means the connection refused
48 RepConnectionRefused byte = 0x05
49 // RepTTLExpired means the TTL expired
50 RepTTLExpired byte = 0x06
51 // RepCommandNotSupported means the request command not supported
52 RepCommandNotSupported byte = 0x07
53 // RepAddressNotSupported means the request address not supported
54 RepAddressNotSupported byte = 0x08
55 )
56
57 // NegotiationRequest is the negotiation reqeust packet
58 type NegotiationRequest struct {
59 Ver byte
60 NMethods byte
61 Methods []byte // 1-255 bytes
62 }
63
64 // NegotiationReply is the negotiation reply packet
65 type NegotiationReply struct {
66 Ver byte
67 Method byte
68 }
69
70 // UserPassNegotiationRequest is the negotiation username/password reqeust packet
71 type UserPassNegotiationRequest struct {
72 Ver byte
73 Ulen byte
74 Uname []byte // 1-255 bytes
75 Plen byte
76 Passwd []byte // 1-255 bytes
77 }
78
79 // UserPassNegotiationReply is the negotiation username/password reply packet
80 type UserPassNegotiationReply struct {
81 Ver byte
82 Status byte
83 }
84
85 // Request is the request packet
86 type Request struct {
87 Ver byte
88 Cmd byte
89 Rsv byte // 0x00
90 Atyp byte
91 DstAddr []byte
92 DstPort []byte // 2 bytes
93 }
94
95 // Reply is the reply packet
96 type Reply struct {
97 Ver byte
98 Rep byte
99 Rsv byte // 0x00
100 Atyp byte
101 // CONNECT socks server's address which used to connect to dst addr
102 // BIND ...
103 // UDP socks server's address which used to connect to dst addr
104 BndAddr []byte
105 // CONNECT socks server's port which used to connect to dst addr
106 // BIND ...
107 // UDP socks server's port which used to connect to dst addr
108 BndPort []byte // 2 bytes
109 }
110
111 // Datagram is the UDP packet
112 type Datagram struct {
113 Rsv []byte // 0x00 0x00
114 Frag byte
115 Atyp byte
116 DstAddr []byte
117 DstPort []byte // 2 bytes
118 Data []byte
119 }