girl 0.65.0 → 0.66.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6d217fe38a61d01846b2cbf57e0a43a5c456406237007c852d6e4f2d69be3bc
4
- data.tar.gz: 61641d8b22ee04b1e0daf71d410fe420939e6e6fd6c6ff65c49641a1f502baaf
3
+ metadata.gz: 1b2ece41d566cc27562dff36a48b1c53c53000390587b5e424bc38e78636e74c
4
+ data.tar.gz: c3d80d9b98804d0f1f37cf479052fc5c68b7cf907c800813cf3dd0d9a1691855
5
5
  SHA512:
6
- metadata.gz: cf51f0e222f05a488ca6c5e437bdd3a6231b1ece0aa184b8907d14f0fe1ff2b3c5daa66bca56c376b1e02ca8162744f1156721f8ad48c73b9b4f3118a73a3cf5
7
- data.tar.gz: b373766e42e420240a47eb5b54f4d3ea6d4c74c630b6a137fc5b91706486635f06717d6e92a1881e92bc841a640f851cb6b8c018e9b2540d16898a8104ae5d24
6
+ metadata.gz: c2c0d92f7dbd582f04a8d49e5285d863e790070a3ffd2c08313695f66388df436fa59441b9fef992600e1611a39053ea3df8b3f453004e2bcbc0ad126c4e257e
7
+ data.tar.gz: e4baabb1843d03f27101e43407927febdf0dd3a1917a30ae017297c75cb5336a32f1fb033bc484ffc0f6cf053a4b3ea63ed8726b4aece5ae662bd72767ff730d
@@ -5,10 +5,10 @@ module Girl
5
5
  WMEMS_LIMIT = 100_000 # 写后上限,达到上限暂停写
6
6
  RESUME_BELOW = 50_000 # 降到多少以下恢复写
7
7
  EXPIRE_NEW = 10 # 创建之后多久没有流量进来,过期
8
- EXPIRE_AFTER = 3600 # 多久没有新流量进来,过期
8
+ EXPIRE_AFTER = 300 # 多久没有新流量,过期
9
9
  CHECK_EXPIRE_INTERVAL = 30 # 检查过期间隔
10
10
  HEARTBEAT_INTERVAL = 30 # 心跳间隔
11
- STATUS_INTERVAL = 0.3 # 发送状态间隔
11
+ STATUS_INTERVAL = 0.5 # 发送状态间隔
12
12
  SEND_STATUS_UNTIL = 10 # 持续的告之对面状态,直到没有流量往来,持续多少秒
13
13
  BREAK_SEND_MISS = 10_000 # miss包个数上限,达到上限忽略要后面的段,可控碎片缓存
14
14
  CONFUSE_UNTIL = 5 # 混淆前几个包
@@ -102,13 +102,14 @@ module Girl
102
102
  now = Time.new
103
103
 
104
104
  if @tun && !@tun.closed?
105
- is_expired = @tun_info[ :last_recv_at ].nil? && ( now - @tun_info[ :created_at ] > EXPIRE_NEW )
105
+ is_expired = @tun_info[ :last_recv_at ] ? ( now - @tun_info[ :last_recv_at ] > EXPIRE_AFTER ) : ( now - @tun_info[ :created_at ] > EXPIRE_NEW )
106
106
 
107
107
  if is_expired
108
108
  puts "p#{ Process.pid } #{ Time.new } expire tun"
109
109
  set_is_closing( @tun )
110
110
  else
111
111
  data = [ 0, HEARTBEAT, rand( 128 ) ].pack( 'Q>CC' )
112
+ # puts "debug1 #{ Time.new } heartbeat"
112
113
  add_tun_ctlmsg( data )
113
114
 
114
115
  @tun_info[ :src_exts ].each do | src_id, src_ext |
@@ -1211,8 +1212,8 @@ module Girl
1211
1212
  data, addrinfo, rflags, *controls = tun.recvmsg
1212
1213
  from_addr = addrinfo.to_sockaddr
1213
1214
  now = Time.new
1214
- pack_id = data[ 0, 8 ].unpack( 'Q>' ).first
1215
1215
  @tun_info[ :last_recv_at ] = now
1216
+ pack_id = data[ 0, 8 ].unpack( 'Q>' ).first
1216
1217
 
1217
1218
  if pack_id == 0
1218
1219
  ctl_num = data[ 8 ].unpack( 'C' ).first
@@ -103,18 +103,22 @@ module Girl
103
103
  is_expired = tund_info[ :last_recv_at ] ? ( now - tund_info[ :last_recv_at ] > EXPIRE_AFTER ) : ( now - tund_info[ :created_at ] > EXPIRE_NEW )
104
104
 
105
105
  if is_expired
106
- puts "p#{ Process.pid } #{ Time.new } expire tund"
106
+ puts "p#{ Process.pid } #{ Time.new } expire tund #{ tund_info[ :port ] }"
107
107
  set_is_closing( tund )
108
- need_trigger = true
109
108
  else
109
+ data = [ 0, HEARTBEAT, rand( 128 ) ].pack( 'Q>CC' )
110
+ # puts "debug1 #{ Time.new } #{ tund_info[ :port ] } heartbeat"
111
+ add_tund_ctlmsg( tund, data )
112
+
110
113
  tund_info[ :dst_exts ].each do | dst_local_port, dst_ext |
111
114
  if dst_ext[ :dst ].closed? && ( now - dst_ext[ :last_continue_at ] > EXPIRE_AFTER )
112
115
  puts "p#{ Process.pid } #{ Time.new } expire dst ext #{ dst_local_port }"
113
116
  del_dst_ext( tund, dst_local_port )
114
- need_trigger = true
115
117
  end
116
118
  end
117
119
  end
120
+
121
+ need_trigger = true
118
122
  end
119
123
  end
120
124
 
@@ -736,7 +740,6 @@ module Girl
736
740
  chunks: [], # 块队列 filename
737
741
  spring: 0, # 块后缀,结块时,如果块队列不为空,则自增,为空,则置为0
738
742
  tun_addr: from_addr, # tun地址
739
- is_tunneled: false, # 是否已和tun打通
740
743
  dst_exts: {}, # dst额外信息 dst_addr => {}
741
744
  dst_local_ports: {}, # src_id => dst_local_port
742
745
  paused: false, # 是否暂停写
@@ -800,7 +803,7 @@ module Girl
800
803
  end
801
804
  end
802
805
 
803
- tund_info[ :is_tunneled ] = true
806
+ tund_info[ :last_recv_at ] = now
804
807
  pack_id = data[ 0, 8 ].unpack( 'Q>' ).first
805
808
 
806
809
  if pack_id == 0
@@ -826,8 +829,6 @@ module Girl
826
829
  return
827
830
  end
828
831
 
829
- tund_info[ :last_recv_at ] = now
830
-
831
832
  data = data[ 17..-1 ]
832
833
  # puts "debug1 #{ data }"
833
834
  destination_domain_port = @custom.decode( data )
@@ -842,7 +843,6 @@ module Girl
842
843
  return unless dst_ext
843
844
 
844
845
  # puts "debug2 got source status"
845
- tund_info[ :last_recv_at ] = now
846
846
 
847
847
  # 更新对面发到几
848
848
  if biggest_src_pack_id > dst_ext[ :biggest_src_pack_id ]
@@ -895,8 +895,6 @@ module Girl
895
895
  dst_ext = tund_info[ :dst_exts ][ dst_local_port ]
896
896
  return unless dst_ext
897
897
 
898
- tund_info[ :last_recv_at ] = now
899
-
900
898
  ( pack_id_begin..pack_id_end ).each do | pack_id |
901
899
  send_at = dst_ext[ :send_ats ][ pack_id ]
902
900
 
@@ -916,8 +914,6 @@ module Girl
916
914
  dst_ext = tund_info[ :dst_exts ][ dst_local_port ]
917
915
  return unless dst_ext
918
916
 
919
- tund_info[ :last_recv_at ] = now
920
-
921
917
  # puts "debug1 got fin1 #{ src_id } biggest src pack #{ biggest_src_pack_id } completed dst pack #{ continue_dst_pack_id }"
922
918
  dst_ext[ :is_src_closed ] = true
923
919
  dst_ext[ :biggest_src_pack_id ] = biggest_src_pack_id
@@ -934,13 +930,10 @@ module Girl
934
930
  dst_local_port = tund_info[ :dst_local_ports ][ src_id ]
935
931
  return unless dst_local_port
936
932
 
937
- tund_info[ :last_recv_at ] = now
938
-
939
933
  # puts "debug1 1-2. recv fin2 -> del dst ext"
940
934
  del_dst_ext( tund, dst_local_port )
941
935
  when TUN_FIN
942
936
  puts "p#{ Process.pid } #{ Time.new } recv tun fin"
943
- tund_info[ :last_recv_at ] = now
944
937
  set_is_closing( tund )
945
938
  end
946
939
 
@@ -956,8 +949,6 @@ module Girl
956
949
  return if dst_ext.nil? || dst_ext[ :dst ].closed?
957
950
  return if ( pack_id <= dst_ext[ :continue_src_pack_id ] ) || dst_ext[ :pieces ].include?( pack_id )
958
951
 
959
- tund_info[ :last_recv_at ] = now
960
-
961
952
  data = data[ 16..-1 ]
962
953
  # puts "debug2 got pack #{ pack_id }"
963
954
 
@@ -1,3 +1,3 @@
1
1
  module Girl
2
- VERSION = '0.65.0'.freeze
2
+ VERSION = '0.66.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.65.0
4
+ version: 0.66.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-06-23 00:00:00.000000000 Z
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: while internet is evil, here's a girl.
14
14
  email: