girl 0.92.0 → 0.93.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fa3e8cb3a29bc4e4e3c02508fe9277a3efc17d1864459999ec8992c685ed729
4
- data.tar.gz: 88b5969712da8922962166e2b17e355c6c5042051e6b18f29f79e9d3aa15845b
3
+ metadata.gz: db00d3852751d26d014f0db01a04a8a3c4d7a43681003dc7b5a61b5af3f42db7
4
+ data.tar.gz: 1938878b1125a8868aa1415a3c9200cf9003dc4310665ebcd7d51aba5871358a
5
5
  SHA512:
6
- metadata.gz: fcf011065b4049ab8d890abb4e38af6dd2f8001359fb78ae555e667fdc9142d6317c7de6c0ef7cfef8bddc537bef845e665d541734e2350f523aadc4e9e75853
7
- data.tar.gz: 942f594fb209cc3797822b9492ac8ba81eaa8d63b1824cac260e21a472b5589b335b7453d2381f5f839b6d3926b501c33cee079aba9da12dd1d7264e2e68580d
6
+ metadata.gz: 6764a6e73718d396b02bac36d0d078741a659cfa1a32de13ef41183b4ed67b98be92e60a4d284abbdc3ee7ce929e872860f9aa7eab7caf715c3371c858eb6553
7
+ data.tar.gz: 1945f2f6bc976654fe9542df2c8145ab983aa16ebdad0100a8893948a4cf076bf7e4851813fbfd459b78601c66bfd1e5fe120d29808b329e1558375509fe4e9c
@@ -2,7 +2,8 @@ module Girl
2
2
  READ_SIZE = 1024 * 1024 # 一次读多少
3
3
  WBUFF_LIMIT = 100 * 1024 * 1024 # 写前上限,超过上限暂停读
4
4
  RESUME_BELOW = WBUFF_LIMIT / 2 # 降到多少以下恢复读
5
- SEND_HELLO_COUNT = 10 # hello最多发几次
5
+ SEND_HELLO_COUNT = 10 # hello/a new source最多发几次
6
+ SEND_HELLO_INTERVAL = 0.5 # 发送hello/a new source间隔
6
7
  EXPIRE_AFTER = 300 # 多久没有新流量,过期
7
8
  CHECK_EXPIRE_INTERVAL = 30 # 检查过期间隔
8
9
  CHECK_RESUME_INTERVAL = 1 # 检查恢复读间隔
@@ -42,6 +43,7 @@ EOF
42
43
  WBUFF_LIMIT
43
44
  RESUME_BELOW
44
45
  SEND_HELLO_COUNT
46
+ SEND_HELLO_INTERVAL
45
47
  EXPIRE_AFTER
46
48
  CHECK_EXPIRE_INTERVAL
47
49
  CHECK_RESUME_INTERVAL
@@ -353,7 +353,7 @@ module Girl
353
353
  def del_src_info( src )
354
354
  src_info = @src_infos.delete( src )
355
355
 
356
- if src_info[ :stream ] && @tun && !@tun.closed? then
356
+ if ( src_info[ :proxy_type ] == :tunnel ) && @tun && !@tun.closed? then
357
357
  @tun_info[ :srcs ].delete( src_info[ :id ] )
358
358
  end
359
359
 
@@ -369,6 +369,7 @@ module Girl
369
369
  sleep CHECK_EXPIRE_INTERVAL
370
370
 
371
371
  @mutex.synchronize do
372
+ trigger = false
372
373
  now = Time.new
373
374
 
374
375
  if @tun && !@tun.closed? then
@@ -382,6 +383,8 @@ module Girl
382
383
  data = [ 0, HEARTBEAT ].pack( 'Q>C' )
383
384
  add_ctlmsg( data )
384
385
  end
386
+
387
+ trigger = true
385
388
  end
386
389
 
387
390
  @src_infos.each do | src, src_info |
@@ -391,10 +394,11 @@ module Girl
391
394
  if ( now - last_recv_at >= EXPIRE_AFTER ) && ( now - last_sent_at >= EXPIRE_AFTER ) then
392
395
  puts "p#{ Process.pid } #{ Time.new } expire src #{ src_info[ :destination_domain ] }"
393
396
  set_src_closing( src )
397
+ trigger = true
394
398
  end
395
399
  end
396
400
 
397
- next_tick
401
+ next_tick if trigger
398
402
  end
399
403
  end
400
404
  end
@@ -492,7 +496,7 @@ module Girl
492
496
  next_tick
493
497
  end
494
498
 
495
- sleep 1
499
+ sleep SEND_HELLO_INTERVAL
496
500
  end
497
501
  end
498
502
  end
@@ -667,7 +671,7 @@ module Girl
667
671
  next_tick
668
672
  end
669
673
 
670
- sleep 1
674
+ sleep SEND_HELLO_INTERVAL
671
675
  end
672
676
  end
673
677
  end
@@ -1,3 +1,3 @@
1
1
  module Girl
2
- VERSION = '0.92.0'.freeze
2
+ VERSION = '0.93.0'.freeze
3
3
  end
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.92.0
4
+ version: 0.93.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-10-11 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: escape evil.
14
14
  email: