forked from txthinking/brook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.go
More file actions
79 lines (68 loc) · 2.88 KB
/
run.go
File metadata and controls
79 lines (68 loc) · 2.88 KB
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
76
77
78
79
package brook
// RunBKServer used to make a new BKServer and start to listen
func RunBKServer(address, password string, timeout, deadline int, m string) error {
s, err := NewBKServer(address, password, timeout, deadline, m)
if err != nil {
return err
}
return s.ListenAndServe()
}
// RunBKClient used to make a new BKClient and start a socks5 proxy to listen
func RunBKClient(address, server, password string, timeout, deadline int, m string) error {
c, err := NewBKClient(address, server, password, timeout, deadline, m, nil)
if err != nil {
return err
}
return c.ListenAndServe(nil)
}
// RunBKHTTPClient used to make a new BKClient and start a http proxy to listen
func RunBKHTTPClient(address, server, password string, timeout, deadline int, m string) error {
c, err := NewBKClient(address, server, password, timeout, deadline, m, nil)
if err != nil {
return err
}
return c.ListenAndServeHTTP(nil)
}
// RunS5Server used to make a new S5Server and start to listen
func RunS5Server(address, password string, timeout, deadline int) error {
s := NewS5Server(address, password, timeout, deadline)
return s.ListenAndServe()
}
// RunS5Client used to make a new S5Client and start a socks5 proxy to listen
func RunS5Client(address, server, password string, timeout, deadline int) error {
c := NewS5Client(address, server, password, timeout, deadline, nil)
return c.ListenAndServe()
}
// RunSSServer used to make a new SSServer and start to listen
func RunSSServer(address, password string, timeout, deadline int) error {
s := NewSSServer(address, password, timeout, deadline)
return s.ListenAndServe()
}
// RunSSClient used to make a new SSClient and start a socks5 proxy to listen
func RunSSClient(address, server, password string, timeout, deadline int) error {
c := NewSSClient(address, server, password, timeout, deadline, nil)
return c.ListenAndServe(nil)
}
// RunSSHTTPClient used to make a new SSClient and start a http proxy to listen
func RunSSHTTPClient(address, server, password string, timeout, deadline int) error {
c := NewSSClient(address, server, password, timeout, deadline, nil)
return c.ListenAndServeHTTP(nil)
}
// RunRelay used to make a new Relay and start to listen
func RunRelay(address, server string, timeout, deadline int) error {
r := NewRelay(address, server, timeout, deadline)
return r.ListenAndServe()
}
// RunSocks5Server used to make a new Socks5Server and start a raw socks5 proxy to listen
func RunSocks5Server(address, username, password string, timeout, deadline int) error {
s := NewSocks5Server(address, username, password, timeout, deadline, nil)
return s.ListenAndServe(nil)
}
// RunSocks5ToHTTP used to make a new Socks5ToHTTP and start a http proxy to listen
func RunSocks5ToHTTP(address, socks5 string, timeout, deadline int) error {
s, err := NewSocks5ToHTTP(address, socks5, timeout, deadline)
if err != nil {
return err
}
return s.ListenAndServe(nil)
}