r_socks 0.1.6 → 0.1.7
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/Gemfile.lock +1 -1
- data/README.md +2 -9
- data/lib/r_socks/connection_handler.rb +8 -3
- data/lib/r_socks/target_connection_handler.rb +13 -3
- data/lib/r_socks/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: 1a7150f7711b2fa8807f99ae87e082947488effb625c3da5a5e4e6467a818535
|
4
|
+
data.tar.gz: 7ab0d14e24184b511036e325d1f003611f53306f2e266f88ef0cb2f52561e37a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1869580601e5c4795cc7f050f8f4683b2c07d7382a7d09b74831bf32fbe3083abf18121a6308649887999e75fc00a809225286cf228deb7491916044656ebac5
|
7
|
+
data.tar.gz: 5e925d6a0b96ca93041a15221f47654f79bea9149afb9363d8aa2b5575f4d1baaa1a8221aa0ae4faacd66664311d55f27b031baef3a25099e705d702561a9324
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# RSocks
|
2
2
|
|
3
|
-
|
3
|
+
this is a socks5 server base on Eventmachine.
|
4
4
|
|
5
|
-
|
5
|
+
can be using as socks5 proxy server side.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -44,13 +44,6 @@ server.config.auth_method = :password
|
|
44
44
|
server.run!
|
45
45
|
```
|
46
46
|
|
47
|
-
|
48
|
-
## Development
|
49
|
-
|
50
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
|
-
|
52
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
|
-
|
54
47
|
## Contributing
|
55
48
|
|
56
49
|
Bug reports and pull requests are welcome on GitHub at https://github.com/nickoan/r_socks.
|
@@ -61,10 +61,10 @@ module RSocks
|
|
61
61
|
return send_data(not_accept) unless @state_machine.start?
|
62
62
|
|
63
63
|
if @target.nil?
|
64
|
-
@target = EventMachine.connect(@addr, @port, RSocks::TargetConnectionHandler, self)
|
64
|
+
@target = EventMachine.connect(@addr, @port, RSocks::TargetConnectionHandler, self, data)
|
65
65
|
end
|
66
66
|
|
67
|
-
@target
|
67
|
+
proxy_incoming_to(@target,60000)
|
68
68
|
rescue => error
|
69
69
|
puts "Error at #{@ip}:#{@port}, message: #{data}, error: #{error.message}"
|
70
70
|
puts error.backtrace
|
@@ -72,7 +72,12 @@ module RSocks
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def unbind
|
75
|
-
|
75
|
+
stop_proxying
|
76
|
+
@target.close_connection_after_writing if @target
|
77
|
+
end
|
78
|
+
|
79
|
+
def proxy_target_unbound
|
80
|
+
close_connection
|
76
81
|
end
|
77
82
|
|
78
83
|
private
|
@@ -3,12 +3,22 @@ require 'eventmachine'
|
|
3
3
|
module RSocks
|
4
4
|
class TargetConnectionHandler < EM::Connection
|
5
5
|
|
6
|
-
def initialize(client)
|
6
|
+
def initialize(client, data)
|
7
7
|
@client = client
|
8
|
+
@init_data = data
|
8
9
|
end
|
9
10
|
|
10
|
-
def
|
11
|
-
@client
|
11
|
+
def post_init
|
12
|
+
proxy_incoming_to(@client,60000)
|
13
|
+
end
|
14
|
+
|
15
|
+
def connection_completed
|
16
|
+
send_data @init_data
|
17
|
+
@init_data = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def proxy_target_unbound
|
21
|
+
close_connection
|
12
22
|
end
|
13
23
|
|
14
24
|
def unbind
|
data/lib/r_socks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_socks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick An
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|