A SOCKS (SOCKS4, SOCKS4A and SOCKS5) Proxy Package for Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.8 KiB

  1. SOCKS 4A: A Simple Extension to SOCKS 4 Protocol
  2. Ying-Da Lee
  3. yingda@best.com or yingda@esd.sgi.com
  4. Please read SOCKS4.protocol first for an description of the version 4
  5. protocol. This extension is intended to allow the use of SOCKS on hosts
  6. which are not capable of resolving all domain names.
  7. In version 4, the client sends the following packet to the SOCKS server
  8. to request a CONNECT or a BIND operation:
  9. +----+----+----+----+----+----+----+----+----+----+....+----+
  10. | VN | CD | DSTPORT | DSTIP | USERID |NULL|
  11. +----+----+----+----+----+----+----+----+----+----+....+----+
  12. # of bytes: 1 1 2 4 variable 1
  13. VN is the SOCKS protocol version number and should be 4. CD is the
  14. SOCKS command code and should be 1 for CONNECT or 2 for BIND. NULL
  15. is a byte of all zero bits.
  16. For version 4A, if the client cannot resolve the destination host's
  17. domain name to find its IP address, it should set the first three bytes
  18. of DSTIP to NULL and the last byte to a non-zero value. (This corresponds
  19. to IP address 0.0.0.x, with x nonzero. As decreed by IANA -- The
  20. Internet Assigned Numbers Authority -- such an address is inadmissible
  21. as a destination IP address and thus should never occur if the client
  22. can resolve the domain name.) Following the NULL byte terminating
  23. USERID, the client must sends the destination domain name and termiantes
  24. it with another NULL byte. This is used for both CONNECT and BIND requests.
  25. A server using protocol 4A must check the DSTIP in the request packet.
  26. If it represent address 0.0.0.x with nonzero x, the server must read
  27. in the domain name that the client sends in the packet. The server
  28. should resolve the domain name and make connection to the destination
  29. host if it can.
  30. SOCKSified sockd may pass domain names that it cannot resolve to
  31. the next-hop SOCKS server.