1 // Example: here's a quickie implementation of the messages in the
4 struct socks5_client_version {
10 struct socks5_server_method {
15 const CMD_CONNECT = 1;
17 const CMD_UDP_ASSOCIATE = 3;
18 // This is a tor extension
19 const CMD_RESOLVE = 0xF0;
20 const CMD_RESOLVE_PTR = 0xF1;
24 const ATYPE_DOMAINNAME = 3;
31 struct socks5_client_request {
33 u8 command IN [CMD_CONNECT, CMD_BIND, CMD_UDP_ASSOCIATE, CMD_RESOLVE, CMD_RESOLVE_PTR];
36 union dest_addr[atype] {
38 ATYPE_IPV6: u8 ipv6[16];
39 ATYPE_DOMAINNAME: struct domainname domainname;
45 struct socks5_server_reply {
50 union bind_addr[atype] {
52 ATYPE_IPV6: u8 ipv6[16];
53 ATYPE_DOMAINNAME: struct domainname domainname;
59 struct socks5_client_userpass_auth {
62 char username[username_len];
64 char passwd[passwd_len];
67 struct socks5_server_userpass_auth {
72 // Oh why not. Here's socks4 and socks4a.
74 struct socks4_client_request {
76 u8 command IN [CMD_CONNECT,CMD_BIND,CMD_RESOLVE,CMD_RESOLVE_PTR];
80 union socks4a_addr[addr] {
88 struct socks4_server_reply {