girl 9.1.3 → 9.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/girl/head.rb +7 -8
- data/lib/girl/proxy.rb +6 -34
- data/lib/girl/proxy_worker.rb +348 -506
- data/lib/girl/proxyd.rb +7 -31
- data/lib/girl/proxyd_worker.rb +531 -272
- data/lib/girl/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a169cd643cb853f29ec9046ac36d027d6ee58dcd0dcda253b631f5a62cb710a6
|
|
4
|
+
data.tar.gz: 47dd11c75a7ab9138d5ac8cc1a724c32dd1b4277077f9399fd81ef80662138b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49c302c5096078a4dd2bcd91d6d8ec161e6d61153f043d47f8f9fb98a84fb8b6c7d0ce151f1fbd78406d7c6ecdecc0dc5814f4f7a9323ab3502d4c89973b1628
|
|
7
|
+
data.tar.gz: 34b61c00f9732ee0001435acd00d3006b5f3e995a2cc153476878dea745bc92e18e7e51eeb93de7c09bd82fdce37ba2323a3abbce87ad8e5f66750fa73c3dd67
|
data/lib/girl/head.rb
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
module Girl
|
|
2
|
-
BACKLOG = 512
|
|
3
|
-
RLIMIT = 1024
|
|
4
|
-
READ_SIZE =
|
|
5
|
-
WBUFF_LIMIT =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
CHECK_TRAFF_INTERVAL = 3600 # 检查今天是否是流量计数重置日间隔
|
|
2
|
+
BACKLOG = 512 # 听队列大小,满后掉SYN包
|
|
3
|
+
RLIMIT = 1024 # sock数上限
|
|
4
|
+
READ_SIZE = 1 * 1024 * 1024 # 一次最多读多少
|
|
5
|
+
WBUFF_LIMIT = 10 * 1024 * 1024 # 写前上限,超过上限暂停读另一头
|
|
6
|
+
CLOSE_ABOVE = 100 * 1024 * 1024 # 超过多少强制关闭
|
|
7
|
+
HEARTBEAT_INTERVAL = 10 # 心跳间隔
|
|
8
|
+
CHECK_TRAFF_INTERVAL = 3600 # 多久检查一次,今天是不是流量计数重置日
|
|
10
9
|
HTTP_OK = "HTTP/1.1 200 OK\r\n\r\n"
|
|
11
10
|
RESERVED_ROUTE = <<EOF
|
|
12
11
|
0.0.0.0/8
|
data/lib/girl/proxy.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'fileutils'
|
|
2
1
|
require 'girl/dns'
|
|
3
2
|
require 'girl/head'
|
|
4
3
|
require 'girl/proxy_worker'
|
|
@@ -23,12 +22,11 @@ module Girl
|
|
|
23
22
|
redir_host = conf[:redir_host]
|
|
24
23
|
redir_port = conf[:redir_port]
|
|
25
24
|
memd_port = conf[:memd_port]
|
|
26
|
-
relayd_host = conf[:relayd_host]
|
|
27
|
-
relayd_port = conf[:relayd_port]
|
|
28
25
|
tspd_host = conf[:tspd_host]
|
|
29
26
|
tspd_port = conf[:tspd_port]
|
|
30
27
|
proxyd_host = conf[:proxyd_host]
|
|
31
28
|
proxyd_port = conf[:proxyd_port]
|
|
29
|
+
bigd_port = conf[:bigd_port]
|
|
32
30
|
nameserver = conf[:nameserver]
|
|
33
31
|
im = conf[:im]
|
|
34
32
|
direct_path = conf[:direct_path]
|
|
@@ -43,18 +41,10 @@ module Girl
|
|
|
43
41
|
h_p1_close = conf[:h_p1_close] # I
|
|
44
42
|
h_p2_close = conf[:h_p2_close] # J
|
|
45
43
|
h_p2_traffic = conf[:h_p2_traffic] # K
|
|
46
|
-
h_p1_overflow = conf[:h_p1_overflow] # L
|
|
47
|
-
h_p1_underhalf = conf[:h_p1_underhalf] # M
|
|
48
|
-
h_p2_overflow = conf[:h_p2_overflow] # N
|
|
49
|
-
h_p2_underhalf = conf[:h_p2_underhalf] # O
|
|
50
44
|
h_query = conf[:h_query] # Q
|
|
51
45
|
h_response = conf[:h_response] # R
|
|
52
46
|
h_src_close = conf[:h_src_close] # S
|
|
53
47
|
h_traffic = conf[:h_traffic] # T
|
|
54
|
-
h_src_overflow = conf[:h_src_overflow] # U
|
|
55
|
-
h_src_underhalf = conf[:h_src_underhalf] # V
|
|
56
|
-
h_dst_overflow = conf[:h_dst_overflow] # W
|
|
57
|
-
h_dst_underhalf = conf[:h_dst_underhalf] # X
|
|
58
48
|
expire_connecting = conf[:expire_connecting] # 连接多久没有建成关闭(秒)
|
|
59
49
|
expire_long_after = conf[:expire_long_after] # 长连接多久没有新流量关闭(秒)
|
|
60
50
|
expire_proxy_after = conf[:expire_proxy_after] # proxy多久没有收到流量重建(秒)
|
|
@@ -64,13 +54,12 @@ module Girl
|
|
|
64
54
|
|
|
65
55
|
redir_host = redir_host ? redir_host.to_s : '0.0.0.0'
|
|
66
56
|
redir_port = redir_port ? redir_port.to_i : 6666
|
|
67
|
-
memd_port = memd_port ? memd_port.to_i : redir_port +
|
|
68
|
-
relayd_host = relayd_host ? relayd_host.to_s : '0.0.0.0'
|
|
69
|
-
relayd_port = relayd_port ? relayd_port.to_i : redir_port + 2
|
|
57
|
+
memd_port = memd_port ? memd_port.to_i : redir_port + 2
|
|
70
58
|
tspd_host = tspd_host ? tspd_host.to_s : '0.0.0.0'
|
|
71
59
|
tspd_port = tspd_port ? tspd_port.to_i : 7777
|
|
72
60
|
raise "missing proxyd host" unless proxyd_host
|
|
73
61
|
proxyd_port = proxyd_port ? proxyd_port.to_i : 6060
|
|
62
|
+
bigd_port = bigd_port ? bigd_port.to_i : proxyd_port + 1
|
|
74
63
|
nameserver = '114.114.114.114' unless nameserver
|
|
75
64
|
nameservers = nameserver.split(' ')
|
|
76
65
|
im = 'office-pc' unless im
|
|
@@ -98,18 +87,10 @@ module Girl
|
|
|
98
87
|
h_p1_close = h_p1_close ? h_p1_close.to_s : 'I'
|
|
99
88
|
h_p2_close = h_p2_close ? h_p2_close.to_s : 'J'
|
|
100
89
|
h_p2_traffic = h_p2_traffic ? h_p2_traffic.to_s : 'K'
|
|
101
|
-
h_p1_overflow = h_p1_overflow ? h_p1_overflow.to_s : 'L'
|
|
102
|
-
h_p1_underhalf = h_p1_underhalf ? h_p1_underhalf.to_s : 'M'
|
|
103
|
-
h_p2_overflow = h_p2_overflow ? h_p2_overflow.to_s : 'N'
|
|
104
|
-
h_p2_underhalf = h_p2_underhalf ? h_p2_underhalf.to_s : 'O'
|
|
105
90
|
h_query = h_query ? h_query.to_s : 'Q'
|
|
106
91
|
h_response = h_response ? h_response.to_s : 'R'
|
|
107
92
|
h_src_close = h_src_close ? h_src_close.to_s : 'S'
|
|
108
93
|
h_traffic = h_traffic ? h_traffic.to_s : 'T'
|
|
109
|
-
h_src_overflow = h_src_overflow ? h_src_overflow.to_s : 'U'
|
|
110
|
-
h_src_underhalf = h_src_underhalf ? h_src_underhalf.to_s : 'V'
|
|
111
|
-
h_dst_overflow = h_dst_overflow ? h_dst_overflow.to_s : 'W'
|
|
112
|
-
h_dst_underhalf = h_dst_underhalf ? h_dst_underhalf.to_s : 'X'
|
|
113
94
|
expire_connecting = expire_connecting ? expire_connecting.to_i : 5
|
|
114
95
|
expire_long_after = expire_long_after ? expire_long_after.to_i : 3600
|
|
115
96
|
expire_proxy_after = expire_proxy_after ? expire_proxy_after.to_i : 60
|
|
@@ -126,7 +107,7 @@ module Girl
|
|
|
126
107
|
end
|
|
127
108
|
end
|
|
128
109
|
|
|
129
|
-
puts "girl proxy #{Girl::VERSION} #{im} #{redir_port} #{
|
|
110
|
+
puts "girl proxy #{Girl::VERSION} #{im} #{redir_port} #{tspd_port}"
|
|
130
111
|
puts "#{proxyd_host} #{proxyd_port} #{appd_host} #{appd_port} #{nameservers.inspect} #{is_client_fastopen} #{is_server_fastopen}"
|
|
131
112
|
puts "#{direct_path} #{directs.size} directs"
|
|
132
113
|
puts "#{remote_path} #{remotes.size} remotes"
|
|
@@ -140,12 +121,11 @@ module Girl
|
|
|
140
121
|
redir_host,
|
|
141
122
|
redir_port,
|
|
142
123
|
memd_port,
|
|
143
|
-
relayd_host,
|
|
144
|
-
relayd_port,
|
|
145
124
|
tspd_host,
|
|
146
125
|
tspd_port,
|
|
147
126
|
proxyd_host,
|
|
148
127
|
proxyd_port,
|
|
128
|
+
bigd_port,
|
|
149
129
|
nameservers,
|
|
150
130
|
im,
|
|
151
131
|
directs,
|
|
@@ -160,18 +140,10 @@ module Girl
|
|
|
160
140
|
h_p1_close,
|
|
161
141
|
h_p2_close,
|
|
162
142
|
h_p2_traffic,
|
|
163
|
-
h_p1_overflow,
|
|
164
|
-
h_p1_underhalf,
|
|
165
|
-
h_p2_overflow,
|
|
166
|
-
h_p2_underhalf,
|
|
167
143
|
h_query,
|
|
168
144
|
h_response,
|
|
169
145
|
h_src_close,
|
|
170
146
|
h_traffic,
|
|
171
|
-
h_src_overflow,
|
|
172
|
-
h_src_underhalf,
|
|
173
|
-
h_dst_overflow,
|
|
174
|
-
h_dst_underhalf,
|
|
175
147
|
expire_connecting,
|
|
176
148
|
expire_long_after,
|
|
177
149
|
expire_proxy_after,
|
|
@@ -179,7 +151,7 @@ module Girl
|
|
|
179
151
|
expire_short_after,
|
|
180
152
|
is_debug,
|
|
181
153
|
is_client_fastopen,
|
|
182
|
-
is_server_fastopen
|
|
154
|
+
is_server_fastopen)
|
|
183
155
|
|
|
184
156
|
Signal.trap(:TERM) do
|
|
185
157
|
puts 'exit'
|