girl 0.71.1 → 0.74.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of girl might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/girl/proxy_worker.rb +77 -75
- data/lib/girl/proxyd_worker.rb +42 -39
- data/lib/girl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '094ccee84b18d04b1061a8c29663acabd184ac524437b2347b34a30cb14a5880'
|
4
|
+
data.tar.gz: 37ef3aa95152d92cf36609eb32bb6658780fea3927ea1b30e062029e7ef1de10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '095868fe1a0d43435db1f8c461f09abd28114cac5f99494a02c5062ede1c476589b623c453e852ca2674727ff9e371c17d5ddc1cce46a408a085ef71c75fcaeb'
|
7
|
+
data.tar.gz: 7a1190902d3f2ef39965f2154d91ab15cabe63adae1613a3ad745a14cd2f46b3c70a3f06174dbda5929af6dd57970a9ca5085c521fd00dcefeaf9009a6fbad16
|
data/lib/girl/proxy_worker.rb
CHANGED
@@ -18,7 +18,6 @@ module Girl
|
|
18
18
|
@writes = []
|
19
19
|
@roles = {} # sock => :dotr / :proxy / :src / :dst / :tun
|
20
20
|
@src_infos = {} # src => {}
|
21
|
-
@dsts = {} # local_port => dst
|
22
21
|
@dst_infos = {} # dst => {}
|
23
22
|
@resolv_caches = {} # domain => [ ip, created_at ]
|
24
23
|
|
@@ -114,7 +113,7 @@ module Girl
|
|
114
113
|
|
115
114
|
@tun_info[ :src_exts ].each do | src_id, src_ext |
|
116
115
|
if src_ext[ :src ].closed? && ( now - src_ext[ :last_continue_at ] > EXPIRE_AFTER )
|
117
|
-
puts "p#{ Process.pid } #{ Time.new } expire src ext #{
|
116
|
+
puts "p#{ Process.pid } #{ Time.new } expire src ext #{ src_ext[ :destination_domain ] }"
|
118
117
|
del_src_ext( src_id )
|
119
118
|
end
|
120
119
|
end
|
@@ -124,20 +123,16 @@ module Girl
|
|
124
123
|
end
|
125
124
|
|
126
125
|
@src_infos.each do | src, src_info |
|
127
|
-
|
128
|
-
|
129
|
-
if is_expired
|
130
|
-
puts "p#{ Process.pid } #{ Time.new } expire src"
|
126
|
+
if now - src_info[ :last_continue_at ] > EXPIRE_AFTER
|
127
|
+
puts "p#{ Process.pid } #{ Time.new } expire src #{ src_info[ :destination_domain ] }"
|
131
128
|
set_is_closing( src )
|
132
129
|
need_trigger = true
|
133
130
|
end
|
134
131
|
end
|
135
132
|
|
136
133
|
@dst_infos.each do | dst, dst_info |
|
137
|
-
|
138
|
-
|
139
|
-
if is_expired
|
140
|
-
puts "p#{ Process.pid } #{ Time.new } expire dst"
|
134
|
+
if now - dst_info[ :last_continue_at ] > EXPIRE_AFTER
|
135
|
+
puts "p#{ Process.pid } #{ Time.new } expire dst #{ dst_info[ :domain ] }"
|
141
136
|
set_is_closing( dst )
|
142
137
|
need_trigger = true
|
143
138
|
end
|
@@ -217,12 +212,6 @@ module Girl
|
|
217
212
|
# resolve domain
|
218
213
|
#
|
219
214
|
def resolve_domain( src, domain )
|
220
|
-
if ( /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/ =~ domain ) && domain.split( '.' ).all? { | part | part.to_i < 256 }
|
221
|
-
# puts "debug1 #{ domain } is a ip"
|
222
|
-
deal_with_destination_ip( src, domain )
|
223
|
-
return
|
224
|
-
end
|
225
|
-
|
226
215
|
if @remotes.any? { | remote | ( domain.size >= remote.size ) && ( domain[ ( remote.size * -1 )..-1 ] == remote ) }
|
227
216
|
# puts "debug1 #{ domain } hit remotes"
|
228
217
|
new_a_src_ext( src )
|
@@ -232,11 +221,11 @@ module Girl
|
|
232
221
|
resolv_cache = @resolv_caches[ domain ]
|
233
222
|
|
234
223
|
if resolv_cache
|
235
|
-
|
224
|
+
ip_info, created_at = resolv_cache
|
236
225
|
|
237
226
|
if Time.new - created_at < RESOLV_CACHE_EXPIRE
|
238
|
-
# puts "debug1 #{ domain } hit resolv cache #{
|
239
|
-
deal_with_destination_ip( src,
|
227
|
+
# puts "debug1 #{ domain } hit resolv cache #{ ip_info.inspect }"
|
228
|
+
deal_with_destination_ip( src, ip_info )
|
240
229
|
return
|
241
230
|
end
|
242
231
|
|
@@ -256,12 +245,11 @@ module Girl
|
|
256
245
|
|
257
246
|
@mutex.synchronize do
|
258
247
|
if ip_info
|
259
|
-
|
260
|
-
# puts "debug1 resolved #{ domain } #{ destination_ip }"
|
261
|
-
@resolv_caches[ domain ] = [ destination_ip, Time.new ]
|
248
|
+
@resolv_caches[ domain ] = [ ip_info, Time.new ]
|
262
249
|
|
263
250
|
unless src.closed?
|
264
|
-
|
251
|
+
puts "p#{ Process.pid } #{ Time.new } resolved #{ domain } #{ ip_info.ip_address }"
|
252
|
+
deal_with_destination_ip( src, ip_info )
|
265
253
|
end
|
266
254
|
else
|
267
255
|
set_is_closing( src )
|
@@ -275,11 +263,11 @@ module Girl
|
|
275
263
|
##
|
276
264
|
# deal with destination ip
|
277
265
|
#
|
278
|
-
def deal_with_destination_ip( src,
|
279
|
-
if @directs.any? { | direct | direct.include?(
|
266
|
+
def deal_with_destination_ip( src, ip_info )
|
267
|
+
if @directs.any? { | direct | direct.include?( ip_info.ip_address ) }
|
280
268
|
# ip命中直连列表,直连
|
281
|
-
# puts "debug1 #{
|
282
|
-
new_a_dst( src,
|
269
|
+
# puts "debug1 #{ ip_info.inspect } hit directs"
|
270
|
+
new_a_dst( src, ip_info )
|
283
271
|
else
|
284
272
|
# 走远端
|
285
273
|
new_a_src_ext( src )
|
@@ -343,10 +331,11 @@ module Girl
|
|
343
331
|
##
|
344
332
|
# new a dst
|
345
333
|
#
|
346
|
-
def new_a_dst( src,
|
334
|
+
def new_a_dst( src, ip_info )
|
347
335
|
src_info = @src_infos[ src ]
|
348
|
-
|
349
|
-
|
336
|
+
domain = src_info[ :destination_domain ]
|
337
|
+
destination_addr = Socket.sockaddr_in( src_info[ :destination_port ], ip_info.ip_address )
|
338
|
+
dst = Socket.new( ip_info.ipv4? ? Socket::AF_INET : Socket::AF_INET6, Socket::SOCK_STREAM, 0 )
|
350
339
|
|
351
340
|
if RUBY_PLATFORM.include?( 'linux' )
|
352
341
|
dst.setsockopt( Socket::SOL_TCP, Socket::TCP_NODELAY, 1 )
|
@@ -364,17 +353,16 @@ module Girl
|
|
364
353
|
|
365
354
|
# puts "debug1 a new dst #{ dst.local_address.inspect }"
|
366
355
|
local_port = dst.local_address.ip_port
|
367
|
-
@dsts[ local_port ] = dst
|
368
356
|
@dst_infos[ dst ] = {
|
369
|
-
local_port: local_port,
|
370
|
-
src: src,
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
is_closing: false
|
357
|
+
local_port: local_port, # 本地端口
|
358
|
+
src: src, # 对应src
|
359
|
+
domain: domain, # 域名
|
360
|
+
wbuff: '', # 写前
|
361
|
+
cache: '', # 块读出缓存
|
362
|
+
chunks: [], # 块队列,写前达到块大小时结一个块 filename
|
363
|
+
spring: 0, # 块后缀,结块时,如果块队列不为空,则自增,为空,则置为0
|
364
|
+
last_continue_at: Time.new, # 上一次发生流量的时间
|
365
|
+
is_closing: false # 是否准备关闭
|
378
366
|
}
|
379
367
|
|
380
368
|
add_read( dst, :dst )
|
@@ -405,27 +393,29 @@ module Girl
|
|
405
393
|
new_a_tun
|
406
394
|
end
|
407
395
|
|
396
|
+
src_info = @src_infos[ src ]
|
397
|
+
src_id = src_info[ :id ]
|
398
|
+
destination_port = src_info[ :destination_port ]
|
399
|
+
destination_domain = src_info[ :destination_domain ]
|
400
|
+
|
408
401
|
src_ext = {
|
409
|
-
src: src,
|
410
|
-
dst_port: nil,
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
402
|
+
src: src, # src
|
403
|
+
dst_port: nil, # 远端dst端口
|
404
|
+
destination_domain: destination_domain, # 目的地域名
|
405
|
+
wmems: {}, # 写后 pack_id => data
|
406
|
+
send_ats: {}, # 上一次发出时间 pack_id => send_at
|
407
|
+
relay_pack_id: 0, # 转发到几
|
408
|
+
continue_dst_pack_id: 0, # 收到几
|
409
|
+
pieces: {}, # 跳号包 dst_pack_id => data
|
410
|
+
is_dst_closed: false, # dst是否已关闭
|
411
|
+
biggest_dst_pack_id: 0, # dst最大包号码
|
412
|
+
completed_pack_id: 0, # 完成到几(对面收到几)
|
413
|
+
last_continue_at: Time.new # 上一次发生流量的时间
|
420
414
|
}
|
421
415
|
|
422
|
-
src_info = @src_infos[ src ]
|
423
|
-
src_id = src_info[ :id ]
|
424
416
|
@tun_info[ :src_exts ][ src_id ] = src_ext
|
425
417
|
src_info[ :proxy_type ] = :tunnel
|
426
418
|
|
427
|
-
destination_port = src_info[ :destination_port ]
|
428
|
-
destination_domain = src_info[ :destination_domain ]
|
429
419
|
destination_domain_port = [ destination_domain, destination_port ].join( ':' )
|
430
420
|
data = [ [ 0, A_NEW_SOURCE, src_id ].pack( 'Q>CQ>' ), @custom.encode( destination_domain_port ) ].join
|
431
421
|
loop_send_a_new_source( src_ext, data )
|
@@ -664,7 +654,6 @@ module Girl
|
|
664
654
|
end
|
665
655
|
end
|
666
656
|
|
667
|
-
@dsts.delete( dst_info[ :local_port ] )
|
668
657
|
set_is_closing( dst_info[ :src ] )
|
669
658
|
end
|
670
659
|
|
@@ -778,6 +767,7 @@ module Girl
|
|
778
767
|
# puts "debug2 write src #{ written }"
|
779
768
|
data = data[ written..-1 ]
|
780
769
|
src_info[ from ] = data
|
770
|
+
src_info[ :last_continue_at ] = Time.new
|
781
771
|
end
|
782
772
|
|
783
773
|
##
|
@@ -829,6 +819,7 @@ module Girl
|
|
829
819
|
# puts "debug2 write dst #{ written }"
|
830
820
|
data = data[ written..-1 ]
|
831
821
|
dst_info[ from ] = data
|
822
|
+
dst_info[ :last_continue_at ] = Time.new
|
832
823
|
end
|
833
824
|
|
834
825
|
##
|
@@ -850,6 +841,10 @@ module Girl
|
|
850
841
|
tun.sendmsg( data, 0, to_addr )
|
851
842
|
rescue IO::WaitWritable, Errno::EINTR
|
852
843
|
return
|
844
|
+
rescue Errno::EHOSTUNREACH, Errno::ENETUNREACH => e
|
845
|
+
puts "#{ Time.new } #{ e.class }, close tun"
|
846
|
+
close_tun( tun )
|
847
|
+
return
|
853
848
|
end
|
854
849
|
|
855
850
|
@tun_info[ :ctlmsgs ].shift
|
@@ -868,6 +863,10 @@ module Girl
|
|
868
863
|
tun.sendmsg( data, 0, @tun_info[ :tund_addr ] )
|
869
864
|
rescue IO::WaitWritable, Errno::EINTR
|
870
865
|
return
|
866
|
+
rescue Errno::EHOSTUNREACH, Errno::ENETUNREACH => e
|
867
|
+
puts "#{ Time.new } #{ e.class }, close tun"
|
868
|
+
close_tun( tun )
|
869
|
+
return
|
871
870
|
end
|
872
871
|
end
|
873
872
|
end
|
@@ -936,6 +935,10 @@ module Girl
|
|
936
935
|
tun.sendmsg( data, 0, @tun_info[ :tund_addr ] )
|
937
936
|
rescue IO::WaitWritable, Errno::EINTR
|
938
937
|
return
|
938
|
+
rescue Errno::EHOSTUNREACH, Errno::ENETUNREACH => e
|
939
|
+
puts "#{ Time.new } #{ e.class }, close tun"
|
940
|
+
close_tun( tun )
|
941
|
+
return
|
939
942
|
end
|
940
943
|
|
941
944
|
# puts "debug2 written pack #{ pack_id }"
|
@@ -969,22 +972,21 @@ module Girl
|
|
969
972
|
# puts "debug1 accept a src #{ addrinfo.inspect } #{ id }"
|
970
973
|
|
971
974
|
@src_infos[ src ] = {
|
972
|
-
id: id,
|
973
|
-
proxy_proto: :uncheck,
|
974
|
-
proxy_type: :uncheck,
|
975
|
-
dst: nil,
|
976
|
-
destination_domain: nil,
|
977
|
-
destination_port: nil,
|
978
|
-
biggest_pack_id: 0,
|
979
|
-
is_connect: true,
|
980
|
-
rbuffs: [],
|
981
|
-
wbuff: '',
|
982
|
-
cache: '',
|
983
|
-
chunks: [],
|
984
|
-
spring: 0,
|
985
|
-
|
986
|
-
|
987
|
-
is_closing: false # 是否准备关闭
|
975
|
+
id: id, # id
|
976
|
+
proxy_proto: :uncheck, # :uncheck / :http / :socks5
|
977
|
+
proxy_type: :uncheck, # :uncheck / :checking / :direct / :tunnel / :negotiation
|
978
|
+
dst: nil, # :direct的场合,对应的dst
|
979
|
+
destination_domain: nil, # 目的地域名
|
980
|
+
destination_port: nil, # 目的地端口
|
981
|
+
biggest_pack_id: 0, # 最大包号码
|
982
|
+
is_connect: true, # 代理协议是http的场合,是否是CONNECT
|
983
|
+
rbuffs: [], # 非CONNECT,dst或者远端dst未准备好,暂存流量 [ pack_id, data ]
|
984
|
+
wbuff: '', # 写前
|
985
|
+
cache: '', # 块读出缓存
|
986
|
+
chunks: [], # 块队列,写前达到块大小时结一个块 filename
|
987
|
+
spring: 0, # 块后缀,结块时,如果块队列不为空,则自增,为空,则置为0
|
988
|
+
last_continue_at: Time.new, # 上一次发生流量的时间
|
989
|
+
is_closing: false # 是否准备关闭
|
988
990
|
}
|
989
991
|
|
990
992
|
add_read( src, :src )
|
@@ -1006,7 +1008,7 @@ module Girl
|
|
1006
1008
|
|
1007
1009
|
# puts "debug2 read src #{ data.inspect }"
|
1008
1010
|
src_info = @src_infos[ src ]
|
1009
|
-
src_info[ :
|
1011
|
+
src_info[ :last_continue_at ] = Time.new
|
1010
1012
|
proxy_type = src_info[ :proxy_type ]
|
1011
1013
|
|
1012
1014
|
case proxy_type
|
@@ -1113,7 +1115,7 @@ module Girl
|
|
1113
1115
|
src_info[ :destination_domain ] = destination_ip
|
1114
1116
|
src_info[ :destination_port ] = destination_port
|
1115
1117
|
# puts "debug1 IP V4 address #{ destination_addrinfo.inspect }"
|
1116
|
-
deal_with_destination_ip( src,
|
1118
|
+
deal_with_destination_ip( src, destination_addrinfo )
|
1117
1119
|
elsif atyp == 3
|
1118
1120
|
domain_len = data[ 4 ].unpack( 'C' ).first
|
1119
1121
|
|
@@ -1196,7 +1198,7 @@ module Girl
|
|
1196
1198
|
|
1197
1199
|
# puts "debug2 read dst #{ data.inspect }"
|
1198
1200
|
dst_info = @dst_infos[ dst ]
|
1199
|
-
dst_info[ :
|
1201
|
+
dst_info[ :last_continue_at ] = Time.new
|
1200
1202
|
src = dst_info[ :src ]
|
1201
1203
|
|
1202
1204
|
if src.closed?
|
data/lib/girl/proxyd_worker.rb
CHANGED
@@ -112,7 +112,7 @@ module Girl
|
|
112
112
|
|
113
113
|
tund_info[ :dst_exts ].each do | dst_local_port, dst_ext |
|
114
114
|
if dst_ext[ :dst ].closed? && ( now - dst_ext[ :last_continue_at ] > EXPIRE_AFTER )
|
115
|
-
puts "p#{ Process.pid } #{ Time.new } expire dst ext #{
|
115
|
+
puts "p#{ Process.pid } #{ Time.new } expire dst ext #{ dst_ext[ :domain_port ] }"
|
116
116
|
del_dst_ext( tund, dst_local_port )
|
117
117
|
end
|
118
118
|
end
|
@@ -123,10 +123,8 @@ module Girl
|
|
123
123
|
end
|
124
124
|
|
125
125
|
@dst_infos.each do | dst, dst_info |
|
126
|
-
|
127
|
-
|
128
|
-
if is_expired
|
129
|
-
puts "p#{ Process.pid } #{ Time.new } expire dst"
|
126
|
+
if now - dst_info[ :last_continue_at ] > EXPIRE_AFTER
|
127
|
+
puts "p#{ Process.pid } #{ Time.new } expire dst #{ dst_info[ :domain_port ] }"
|
130
128
|
set_is_closing( dst )
|
131
129
|
need_trigger = true
|
132
130
|
end
|
@@ -195,7 +193,7 @@ module Girl
|
|
195
193
|
|
196
194
|
if Time.new - created_at < RESOLV_CACHE_EXPIRE
|
197
195
|
# puts "debug1 #{ destination_domain_port } hit resolv cache #{ Addrinfo.new( destination_addr ).inspect }"
|
198
|
-
deal_with_destination_addr( tund, src_id, destination_addr )
|
196
|
+
deal_with_destination_addr( tund, src_id, destination_addr, destination_domain_port )
|
199
197
|
return
|
200
198
|
end
|
201
199
|
|
@@ -204,13 +202,17 @@ module Girl
|
|
204
202
|
end
|
205
203
|
|
206
204
|
Thread.new do
|
207
|
-
|
208
|
-
destination_port = destination_port.to_i
|
205
|
+
colon_idx = destination_domain_port.rindex( ':' )
|
209
206
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
207
|
+
if colon_idx
|
208
|
+
destination_domain = destination_domain_port[ 0...colon_idx ]
|
209
|
+
destination_port = destination_domain_port[ ( colon_idx + 1 )..-1 ].to_i
|
210
|
+
|
211
|
+
begin
|
212
|
+
destination_addr = Socket.sockaddr_in( destination_port, destination_domain )
|
213
|
+
rescue Exception => e
|
214
|
+
puts "p#{ Process.pid } #{ Time.new } sockaddr in #{ destination_domain_port } #{ e.class }"
|
215
|
+
end
|
214
216
|
end
|
215
217
|
|
216
218
|
@mutex.synchronize do
|
@@ -219,7 +221,7 @@ module Girl
|
|
219
221
|
@resolv_caches[ destination_domain_port ] = [ destination_addr, Time.new ]
|
220
222
|
|
221
223
|
unless tund.closed?
|
222
|
-
if deal_with_destination_addr( tund, src_id, destination_addr )
|
224
|
+
if deal_with_destination_addr( tund, src_id, destination_addr, destination_domain_port )
|
223
225
|
next_tick
|
224
226
|
end
|
225
227
|
end
|
@@ -231,8 +233,8 @@ module Girl
|
|
231
233
|
##
|
232
234
|
# deal with destination addr
|
233
235
|
#
|
234
|
-
def deal_with_destination_addr( tund, src_id, destination_addr )
|
235
|
-
dst = Socket.new( Socket::AF_INET, Socket::SOCK_STREAM, 0 )
|
236
|
+
def deal_with_destination_addr( tund, src_id, destination_addr, destination_domain_port )
|
237
|
+
dst = Socket.new( Addrinfo.new( destination_addr ).ipv4? ? Socket::AF_INET : Socket::AF_INET6, Socket::SOCK_STREAM, 0 )
|
236
238
|
dst.setsockopt( Socket::SOL_TCP, Socket::TCP_NODELAY, 1 )
|
237
239
|
|
238
240
|
begin
|
@@ -246,33 +248,34 @@ module Girl
|
|
246
248
|
local_port = dst.local_address.ip_port
|
247
249
|
|
248
250
|
@dst_infos[ dst ] = {
|
249
|
-
local_port: local_port,
|
250
|
-
tund: tund,
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
is_closing: false
|
251
|
+
local_port: local_port, # 本地端口
|
252
|
+
tund: tund, # 对应tund
|
253
|
+
domain_port: destination_domain_port, # 域名和端口
|
254
|
+
biggest_pack_id: 0, # 最大包号码
|
255
|
+
wbuff: '', # 写前
|
256
|
+
cache: '', # 块读出缓存
|
257
|
+
chunks: [], # 块队列,写前达到块大小时结一个块 filename
|
258
|
+
spring: 0, # 块后缀,结块时,如果块队列不为空,则自增,为空,则置为0
|
259
|
+
last_continue_at: Time.new, # 上一次发生流量的时间
|
260
|
+
is_closing: false # 是否准备关闭
|
259
261
|
}
|
260
262
|
add_read( dst, :dst )
|
261
263
|
|
262
264
|
tund_info = @tund_infos[ tund ]
|
263
265
|
tund_info[ :dst_local_ports ][ src_id ] = local_port
|
264
266
|
tund_info[ :dst_exts ][ local_port ] = {
|
265
|
-
dst: dst,
|
266
|
-
src_id: src_id,
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
267
|
+
dst: dst, # dst
|
268
|
+
src_id: src_id, # 近端src id
|
269
|
+
domain_port: destination_domain_port, # 域名和端口
|
270
|
+
wmems: {}, # 写后 pack_id => data
|
271
|
+
send_ats: {}, # 上一次发出时间 pack_id => send_at
|
272
|
+
relay_pack_id: 0, # 转发到几
|
273
|
+
continue_src_pack_id: 0, # 收到几
|
274
|
+
pieces: {}, # 跳号包 src_pack_id => data
|
275
|
+
is_src_closed: false, # src是否已关闭
|
276
|
+
biggest_src_pack_id: 0, # src最大包号码
|
277
|
+
completed_pack_id: 0, # 完成到几(对面收到几)
|
278
|
+
last_continue_at: Time.new # 上一次发生流量的时间
|
276
279
|
}
|
277
280
|
|
278
281
|
data = [ 0, PAIRED, src_id, local_port ].pack( 'Q>CQ>n' )
|
@@ -582,6 +585,7 @@ module Girl
|
|
582
585
|
# puts "debug2 write dst #{ written }"
|
583
586
|
data = data[ written..-1 ]
|
584
587
|
dst_info[ from ] = data
|
588
|
+
dst_info[ :last_continue_at ] = Time.new
|
585
589
|
end
|
586
590
|
|
587
591
|
##
|
@@ -771,7 +775,7 @@ module Girl
|
|
771
775
|
|
772
776
|
# puts "debug2 read dst #{ data.inspect }"
|
773
777
|
dst_info = @dst_infos[ dst ]
|
774
|
-
dst_info[ :
|
778
|
+
dst_info[ :last_continue_at ] = Time.new
|
775
779
|
tund = dst_info[ :tund ]
|
776
780
|
|
777
781
|
if tund.closed?
|
@@ -814,7 +818,6 @@ module Girl
|
|
814
818
|
when A_NEW_SOURCE
|
815
819
|
src_id = data[ 9, 8 ].unpack( 'Q>' ).first
|
816
820
|
dst_local_port = tund_info[ :dst_local_ports ][ src_id ]
|
817
|
-
# puts "debug1 got a new source #{ src_id }"
|
818
821
|
|
819
822
|
if dst_local_port
|
820
823
|
dst_ext = tund_info[ :dst_exts ][ dst_local_port ]
|
@@ -831,8 +834,8 @@ module Girl
|
|
831
834
|
end
|
832
835
|
|
833
836
|
data = data[ 17..-1 ]
|
834
|
-
# puts "debug1 #{ data }"
|
835
837
|
destination_domain_port = @custom.decode( data )
|
838
|
+
puts "p#{ Process.pid } #{ Time.new } a new source #{ src_id } #{ destination_domain_port }"
|
836
839
|
resolve_domain( tund, src_id, destination_domain_port )
|
837
840
|
when SOURCE_STATUS
|
838
841
|
src_id, relay_src_pack_id, continue_dst_pack_id = data[ 9, 24 ].unpack( 'Q>Q>Q>' )
|
data/lib/girl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: girl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.74.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takafan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: while internet is evil, here's a girl.
|
14
14
|
email:
|