girl 0.78.0 → 0.79.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 +28 -34
- data/lib/girl/proxyd_worker.rb +25 -29
- 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: d0715fdbe86cdb5337e31fc9fb79d110468d8d041a34806a8d75eeb5a235b723
|
4
|
+
data.tar.gz: 839d97ba88a903a3950082b8ed68ce8a9d03f1870bd910307bdbf76ac9057f48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bec7fd4e3de14f55c88cc1adff7f0f51e5f154601322c55e391d7401290a34455d547dc5fc38fa0fbc2cfe5abb77d1feb53acc6225d3202d945c4a4ea803e8c
|
7
|
+
data.tar.gz: f3df7300a53d259ad6c5a91c67edd7d2b7a160fd1c33700266377e6e075c31cc6522c5af3765700d35f2b8db13ac012c74d674655b4bfab988b5f579deb30d0a
|
data/lib/girl/proxy_worker.rb
CHANGED
@@ -741,15 +741,14 @@ module Girl
|
|
741
741
|
#
|
742
742
|
def write_src( src )
|
743
743
|
src_info = @src_infos[ src ]
|
744
|
-
data = src_info[ :cache ]
|
745
|
-
from = :cache
|
744
|
+
from, data = :cache, src_info[ :cache ]
|
746
745
|
|
747
746
|
if data.empty?
|
748
747
|
if src_info[ :chunks ].any?
|
749
748
|
path = File.join( @src_chunk_dir, src_info[ :chunks ].shift )
|
750
749
|
|
751
750
|
begin
|
752
|
-
src_info[ :cache ] =
|
751
|
+
data = src_info[ :cache ] = IO.binread( path )
|
753
752
|
File.delete( path )
|
754
753
|
rescue Errno::ENOENT => e
|
755
754
|
puts "p#{ Process.pid } #{ Time.new } read #{ path } #{ e.class }"
|
@@ -757,8 +756,7 @@ module Girl
|
|
757
756
|
return
|
758
757
|
end
|
759
758
|
else
|
760
|
-
data = src_info[ :wbuff ]
|
761
|
-
from = :wbuff
|
759
|
+
from, data = :wbuff, src_info[ :wbuff ]
|
762
760
|
end
|
763
761
|
end
|
764
762
|
|
@@ -792,15 +790,14 @@ module Girl
|
|
792
790
|
#
|
793
791
|
def write_dst( dst )
|
794
792
|
dst_info = @dst_infos[ dst ]
|
795
|
-
data = dst_info[ :cache ]
|
796
|
-
from = :cache
|
793
|
+
from, data = :cache, dst_info[ :cache ]
|
797
794
|
|
798
795
|
if data.empty?
|
799
796
|
if dst_info[ :chunks ].any?
|
800
797
|
path = File.join( @dst_chunk_dir, dst_info[ :chunks ].shift )
|
801
798
|
|
802
799
|
begin
|
803
|
-
dst_info[ :cache ] =
|
800
|
+
data = dst_info[ :cache ] = IO.binread( path )
|
804
801
|
File.delete( path )
|
805
802
|
rescue Errno::ENOENT => e
|
806
803
|
puts "p#{ Process.pid } #{ Time.new } read #{ path } #{ e.class }"
|
@@ -808,8 +805,7 @@ module Girl
|
|
808
805
|
return
|
809
806
|
end
|
810
807
|
else
|
811
|
-
data = dst_info[ :wbuff ]
|
812
|
-
from = :wbuff
|
808
|
+
from, data = :wbuff, dst_info[ :wbuff ]
|
813
809
|
end
|
814
810
|
end
|
815
811
|
|
@@ -879,7 +875,6 @@ module Girl
|
|
879
875
|
end
|
880
876
|
|
881
877
|
@tun_info[ :resendings ].shift
|
882
|
-
return
|
883
878
|
end
|
884
879
|
|
885
880
|
# 若写后达到上限,暂停取写前
|
@@ -895,8 +890,7 @@ module Girl
|
|
895
890
|
|
896
891
|
# 取写前
|
897
892
|
if @tun_info[ :caches ].any?
|
898
|
-
|
899
|
-
from = :caches
|
893
|
+
datas = @tun_info[ :caches ]
|
900
894
|
elsif @tun_info[ :chunks ].any?
|
901
895
|
path = File.join( @tun_chunk_dir, @tun_info[ :chunks ].shift )
|
902
896
|
|
@@ -917,39 +911,39 @@ module Girl
|
|
917
911
|
data = data[ ( 18 + pack_size )..-1 ]
|
918
912
|
end
|
919
913
|
|
920
|
-
@tun_info[ :caches ] = caches
|
921
|
-
src_id, pack_id, data = caches.first
|
922
|
-
from = :caches
|
914
|
+
datas = @tun_info[ :caches ] = caches
|
923
915
|
elsif @tun_info[ :wbuffs ].any?
|
924
|
-
|
925
|
-
from = :wbuffs
|
916
|
+
datas = @tun_info[ :wbuffs ]
|
926
917
|
else
|
927
918
|
@writes.delete( tun )
|
928
919
|
return
|
929
920
|
end
|
930
921
|
|
931
|
-
|
922
|
+
while datas.any?
|
923
|
+
src_id, pack_id, data = datas.first
|
924
|
+
src_ext = @tun_info[ :src_exts ][ src_id ]
|
932
925
|
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
926
|
+
if src_ext
|
927
|
+
if pack_id <= CONFUSE_UNTIL
|
928
|
+
data = @custom.encode( data )
|
929
|
+
# puts "debug1 encoded pack #{ pack_id }"
|
930
|
+
end
|
938
931
|
|
939
|
-
|
932
|
+
data = [ [ pack_id, src_id ].pack( 'Q>Q>' ), data ].join
|
940
933
|
|
941
|
-
|
942
|
-
|
934
|
+
unless send_data( tun, data, @tun_info[ :tund_addr ] )
|
935
|
+
return
|
936
|
+
end
|
937
|
+
|
938
|
+
# puts "debug2 written pack #{ pack_id }"
|
939
|
+
src_ext[ :relay_pack_id ] = pack_id
|
940
|
+
src_ext[ :wmems ][ pack_id ] = data
|
941
|
+
src_ext[ :send_ats ][ pack_id ] = now
|
942
|
+
src_ext[ :last_continue_at ] = now
|
943
943
|
end
|
944
944
|
|
945
|
-
|
946
|
-
src_ext[ :relay_pack_id ] = pack_id
|
947
|
-
src_ext[ :wmems ][ pack_id ] = data
|
948
|
-
src_ext[ :send_ats ][ pack_id ] = now
|
949
|
-
src_ext[ :last_continue_at ] = now
|
945
|
+
datas.shift
|
950
946
|
end
|
951
|
-
|
952
|
-
@tun_info[ from ].shift
|
953
947
|
end
|
954
948
|
|
955
949
|
##
|
data/lib/girl/proxyd_worker.rb
CHANGED
@@ -558,15 +558,14 @@ module Girl
|
|
558
558
|
#
|
559
559
|
def write_dst( dst )
|
560
560
|
dst_info = @dst_infos[ dst ]
|
561
|
-
data = dst_info[ :cache ]
|
562
|
-
from = :cache
|
561
|
+
from, data = :cache, dst_info[ :cache ]
|
563
562
|
|
564
563
|
if data.empty?
|
565
564
|
if dst_info[ :chunks ].any?
|
566
565
|
path = File.join( @dst_chunk_dir, dst_info[ :chunks ].shift )
|
567
566
|
|
568
567
|
begin
|
569
|
-
dst_info[ :cache ] =
|
568
|
+
data = dst_info[ :cache ] = IO.binread( path )
|
570
569
|
File.delete( path )
|
571
570
|
rescue Errno::ENOENT => e
|
572
571
|
puts "p#{ Process.pid } #{ Time.new } read #{ path } #{ e.class }"
|
@@ -574,8 +573,7 @@ module Girl
|
|
574
573
|
return
|
575
574
|
end
|
576
575
|
else
|
577
|
-
data = dst_info[ :wbuff ]
|
578
|
-
from = :wbuff
|
576
|
+
from, data = :wbuff, dst_info[ :wbuff ]
|
579
577
|
end
|
580
578
|
end
|
581
579
|
|
@@ -646,7 +644,6 @@ module Girl
|
|
646
644
|
end
|
647
645
|
|
648
646
|
tund_info[ :resendings ].shift
|
649
|
-
return
|
650
647
|
end
|
651
648
|
|
652
649
|
# 若写后达到上限,暂停取写前
|
@@ -662,8 +659,7 @@ module Girl
|
|
662
659
|
|
663
660
|
# 取写前
|
664
661
|
if tund_info[ :caches ].any?
|
665
|
-
|
666
|
-
from = :caches
|
662
|
+
datas = tund_info[ :caches ]
|
667
663
|
elsif tund_info[ :chunks ].any?
|
668
664
|
path = File.join( @tund_chunk_dir, tund_info[ :chunks ].shift )
|
669
665
|
|
@@ -684,39 +680,39 @@ module Girl
|
|
684
680
|
data = data[ ( 12 + pack_size )..-1 ]
|
685
681
|
end
|
686
682
|
|
687
|
-
tund_info[ :caches ] = caches
|
688
|
-
dst_local_port, pack_id, data = caches.first
|
689
|
-
from = :caches
|
683
|
+
datas = tund_info[ :caches ] = caches
|
690
684
|
elsif tund_info[ :wbuffs ].any?
|
691
|
-
|
692
|
-
from = :wbuffs
|
685
|
+
datas = tund_info[ :wbuffs ]
|
693
686
|
else
|
694
687
|
@writes.delete( tund )
|
695
688
|
return
|
696
689
|
end
|
697
690
|
|
698
|
-
|
691
|
+
while datas.any?
|
692
|
+
dst_local_port, pack_id, data = datas.first
|
693
|
+
dst_ext = tund_info[ :dst_exts ][ dst_local_port ]
|
699
694
|
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
695
|
+
if dst_ext
|
696
|
+
if pack_id <= CONFUSE_UNTIL
|
697
|
+
data = @custom.encode( data )
|
698
|
+
# puts "debug1 encoded pack #{ pack_id }"
|
699
|
+
end
|
705
700
|
|
706
|
-
|
701
|
+
data = [ [ pack_id, dst_local_port ].pack( 'Q>n' ), data ].join
|
707
702
|
|
708
|
-
|
709
|
-
|
703
|
+
unless send_data( tund, data, tund_info[ :tun_addr ] )
|
704
|
+
return
|
705
|
+
end
|
706
|
+
|
707
|
+
# puts "debug2 written pack #{ pack_id }"
|
708
|
+
dst_ext[ :relay_pack_id ] = pack_id
|
709
|
+
dst_ext[ :wmems ][ pack_id ] = data
|
710
|
+
dst_ext[ :send_ats ][ pack_id ] = now
|
711
|
+
dst_ext[ :last_continue_at ] = now
|
710
712
|
end
|
711
713
|
|
712
|
-
|
713
|
-
dst_ext[ :relay_pack_id ] = pack_id
|
714
|
-
dst_ext[ :wmems ][ pack_id ] = data
|
715
|
-
dst_ext[ :send_ats ][ pack_id ] = now
|
716
|
-
dst_ext[ :last_continue_at ] = now
|
714
|
+
datas.shift
|
717
715
|
end
|
718
|
-
|
719
|
-
tund_info[ from ].shift
|
720
716
|
end
|
721
717
|
|
722
718
|
##
|
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.79.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-08-
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: while internet is evil, here's a girl.
|
14
14
|
email:
|