genred2config.sh 993 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/sh
  2. cat <<-EOF >$1
  3. base {
  4. log_debug = off;
  5. log_info = off;
  6. log = stderr;
  7. daemon = on;
  8. redirector = iptables;
  9. reuseport = on;
  10. }
  11. EOF
  12. if [ "$2" == "socks5" ]; then
  13. if [ "$3" == "tcp" ]; then
  14. if [ "$7" == "0" ]; then
  15. cat <<-EOF >>$1
  16. redsocks {
  17. bind = "0.0.0.0:$4";
  18. relay = "$5:$6";
  19. type = socks5;
  20. autoproxy = 0;
  21. timeout = 10;
  22. }
  23. EOF
  24. else
  25. cat <<-EOF >>$1
  26. redsocks {
  27. bind = "0.0.0.0:$4";
  28. relay = "$5:$6";
  29. type = socks5;
  30. autoproxy = 0;
  31. timeout = 10;
  32. login = "$8";
  33. password = "$9";
  34. }
  35. EOF
  36. fi
  37. else
  38. if [ "$7" == "0" ]; then
  39. cat <<-EOF >>$1
  40. redudp {
  41. bind = "0.0.0.0:$4";
  42. relay = "$5:$6";
  43. type = socks5;
  44. udp_timeout = 10;
  45. }
  46. EOF
  47. else
  48. cat <<-EOF >>$1
  49. redudp {
  50. bind = "0.0.0.0:$4";
  51. relay = "$5:$6";
  52. type = socks5;
  53. udp_timeout = 10;
  54. login = "$8";
  55. password = "$9";
  56. }
  57. EOF
  58. fi
  59. fi
  60. else
  61. cat <<-EOF >>$1
  62. redsocks {
  63. bind = "0.0.0.0:$4";
  64. type = direct;
  65. interface = $3;
  66. autoproxy = 0;
  67. timeout = 10;
  68. }
  69. EOF
  70. fi