socks_tunnel 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dddadc3f63d978799189f6fa955e3f810ad77a2e
4
- data.tar.gz: ef0d4d891892564a69d559d791d436274a488708
3
+ metadata.gz: 73ff01f52b156dcdac94e1b8a56d879475f7e419
4
+ data.tar.gz: 8debcb7067533ad32cba90ea791432a5d2d44f1b
5
5
  SHA512:
6
- metadata.gz: 0bc01a03e50e7b585a7b9a6756df027b9589d4c29c1d3a18f370c0149d3f94d9959ba5d62983b25196b711135c917627907a00bfea61979112705f18f250cd2f
7
- data.tar.gz: 02e8978e9b80d7d04c67dee7769bfad33e2dee49843e6bbd43cb4f62fb992852a1baf5c6a706963a0077d4b2ee85240c154cd51353c503e24a7b61c680a93b47
6
+ metadata.gz: 1c7fc44f586c0c4f368b9b488d2b33967728bb4372a2dc2e240149a8193db9f8f77d302a53af10b8fbb3342fe53813f3c551cb62c44931e53b4382c6f2198e01
7
+ data.tar.gz: c3fc5c99ec378e817d213ce8ac1b3502617f95fda67e2f26767b7e0e6283cf6a9b321e212fe6a254cfe81ccf72a2f9bcd9aa055d39d38514513d368a5088187d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SocksTunnel
2
2
 
3
- Establish secure tunnel via Socks 5.
3
+ Establish secure tunnel via Socks 5 base on EventMachine. Recently support TCP only.
4
4
 
5
5
  ## Installation
6
6
 
@@ -30,6 +30,9 @@ Options
30
30
  <tr>
31
31
  <td>--salt</td><td>The salt for generating encryption key and iv.</td><td>Optional</td>
32
32
  </tr>
33
+ <tr>
34
+ <td>--daemon</td><td>Run in the background.</td><td>Optional</td>
35
+ </tr>
33
36
  </table>
34
37
 
35
38
  Start remote server
@@ -48,6 +51,9 @@ Options
48
51
  <tr>
49
52
  <td>--salt</td><td>The salt for generating encryption key and iv.</td><td>Optional</td>
50
53
  </tr>
54
+ <tr>
55
+ <td>--daemon</td><td>Run in the background.</td><td>Optional</td>
56
+ </tr>
51
57
  </table>
52
58
 
53
59
  *Password* and *Salt* used in both local and remote server should be the same.
@@ -7,6 +7,7 @@ module SocksTunnel
7
7
  option :port, required: true
8
8
  option :password, required: true
9
9
  option :remote_addr, required: true
10
+ option :daemon, type: :boolean
10
11
  option :host
11
12
  def local
12
13
  Config.from(options)
@@ -16,6 +17,7 @@ module SocksTunnel
16
17
  desc "remote", "Start remote server"
17
18
  option :port, required: true
18
19
  option :password, required: true
20
+ option :daemon, type: :boolean
19
21
  def remote
20
22
  Config.from(options)
21
23
  Remote.run
@@ -2,7 +2,7 @@ module SocksTunnel
2
2
  class Config
3
3
  class << self
4
4
  attr_accessor :local_server_host, :local_server_port,
5
- :remote_server_host, :remote_server_port, :password, :salt
5
+ :remote_server_host, :remote_server_port, :password, :salt, :daemon
6
6
 
7
7
  def from(options)
8
8
  if options[:remote_addr]
@@ -14,6 +14,7 @@ module SocksTunnel
14
14
  end
15
15
  @password = options[:password]
16
16
  @salt = options[:salt] if options[:salt]
17
+ @daemon = options[:daemon] if options[:daemon]
17
18
  end
18
19
 
19
20
  def local_server_host
@@ -31,6 +32,10 @@ module SocksTunnel
31
32
  def cipher
32
33
  @cipher ||= 'AES-256-CBC'
33
34
  end
35
+
36
+ def daemon?
37
+ !!@daemon
38
+ end
34
39
  end
35
40
  end
36
41
  end
@@ -6,6 +6,7 @@ module SocksTunnel
6
6
  EventMachine.run do
7
7
  puts "Start local server at #{Config.local_server_host}:#{Config.local_server_port}"
8
8
  EventMachine.start_server(Config.local_server_host, Config.local_server_port, Server)
9
+ Process.daemon if Config.daemon?
9
10
  end
10
11
  end
11
12
 
@@ -4,6 +4,7 @@ module SocksTunnel
4
4
  EventMachine.run do
5
5
  puts "Start remote server at 0.0.0.0:#{Config.remote_server_port}"
6
6
  EventMachine.start_server('0.0.0.0', Config.remote_server_port, Server)
7
+ Process.daemon if Config.daemon?
7
8
  end
8
9
  end
9
10
 
@@ -1,3 +1,3 @@
1
1
  module SocksTunnel
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socks_tunnel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weihu Chen