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