tun2socks.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) Ambroz Bizjak <ambrop7@gmail.com>
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. * 1. Redistributions of source code must retain the above copyright
  7. * notice, this list of conditions and the following disclaimer.
  8. * 2. Redistributions in binary form must reproduce the above copyright
  9. * notice, this list of conditions and the following disclaimer in the
  10. * documentation and/or other materials provided with the distribution.
  11. * 3. Neither the name of the author nor the
  12. * names of its contributors may be used to endorse or promote products
  13. * derived from this software without specific prior written permission.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  16. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  19. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. // name of the program
  27. #define PROGRAM_NAME "tun2socks"
  28. // size of temporary buffer for passing data from the SOCKS server to TCP for sending
  29. #define CLIENT_SOCKS_RECV_BUF_SIZE 8192
  30. // maximum number of udpgw connections
  31. #define DEFAULT_UDPGW_MAX_CONNECTIONS 256
  32. // udpgw per-connection send buffer size, in number of packets
  33. #define DEFAULT_UDPGW_CONNECTION_BUFFER_SIZE 8
  34. // udpgw reconnect time after connection fails
  35. #define UDPGW_RECONNECT_TIME 5000
  36. // udpgw keepalive sending interval
  37. #define UDPGW_KEEPALIVE_TIME 10000
  38. // option to override the destination addresses to give the SOCKS server
  39. //#define OVERRIDE_DEST_ADDR "10.111.0.2:2000"
  40. // Max number of buffered outgoing UDP packets for SOCKS5-UDP. It should be large
  41. // enough to prevent packet loss while the SOCKS UDP association is being set up. A slow
  42. // or far-away SOCKS server could require 300 ms to connect, and a chatty client (e.g.
  43. // STUN) could send a packet every 20 ms, so a default limit of 16 seems reasonable.
  44. #define SOCKS_UDP_SEND_BUFFER_PACKETS 16