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