args.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package services
  2. // tcp := app.Command("tcp", "proxy on tcp mode")
  3. // t := tcp.Flag("tcp-timeout", "tcp timeout milliseconds when connect to real server or parent proxy").Default("2000").Int()
  4. const (
  5. TYPE_TCP = "tcp"
  6. TYPE_UDP = "udp"
  7. TYPE_HTTP = "http"
  8. TYPE_TLS = "tls"
  9. CONN_CONTROL = uint8(1)
  10. CONN_SERVER = uint8(2)
  11. CONN_CLIENT = uint8(3)
  12. )
  13. type Args struct {
  14. Local *string
  15. Parent *string
  16. CertBytes []byte
  17. KeyBytes []byte
  18. }
  19. type TunnelServerArgs struct {
  20. Args
  21. IsUDP *bool
  22. Key *string
  23. Timeout *int
  24. }
  25. type TunnelClientArgs struct {
  26. Args
  27. IsUDP *bool
  28. Key *string
  29. Timeout *int
  30. }
  31. type TunnelBridgeArgs struct {
  32. Args
  33. Timeout *int
  34. }
  35. type TCPArgs struct {
  36. Args
  37. ParentType *string
  38. IsTLS *bool
  39. Timeout *int
  40. PoolSize *int
  41. CheckParentInterval *int
  42. }
  43. type HTTPArgs struct {
  44. Args
  45. Always *bool
  46. HTTPTimeout *int
  47. Interval *int
  48. Blocked *string
  49. Direct *string
  50. AuthFile *string
  51. Auth *[]string
  52. ParentType *string
  53. LocalType *string
  54. Timeout *int
  55. PoolSize *int
  56. CheckParentInterval *int
  57. }
  58. type UDPArgs struct {
  59. Args
  60. ParentType *string
  61. Timeout *int
  62. PoolSize *int
  63. CheckParentInterval *int
  64. }
  65. func (a *TCPArgs) Protocol() string {
  66. if *a.IsTLS {
  67. return "tls"
  68. }
  69. return "tcp"
  70. }