bachue-socksify 1.6.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.
@@ -0,0 +1,55 @@
1
+ module Socksify
2
+ class Color
3
+ class Reset
4
+ def self::to_s
5
+ "\e[0m\e[37m"
6
+ end
7
+ end
8
+
9
+ class Red < Color
10
+ def num; 31; end
11
+ end
12
+ class Green < Color
13
+ def num; 32; end
14
+ end
15
+ class Yellow < Color
16
+ def num; 33; end
17
+ end
18
+
19
+ def self::to_s
20
+ new.to_s
21
+ end
22
+
23
+ def to_s
24
+ "\e[1m\e[#{num}m"
25
+ end
26
+ end
27
+
28
+ def self.debug=(enabled)
29
+ @@debug = enabled
30
+ end
31
+
32
+ def self.debug_debug(str)
33
+ debug(Color::Green, str)
34
+ end
35
+
36
+ def self.debug_notice(str)
37
+ debug(Color::Yellow, str)
38
+ end
39
+
40
+ def self.debug_error(str)
41
+ debug(Color::Red, str)
42
+ end
43
+
44
+ private
45
+
46
+ def self.debug(color, str)
47
+ if defined? @@debug
48
+ puts "#{color}#{now_s}#{Color::Reset} #{str}"
49
+ end
50
+ end
51
+
52
+ def self.now_s
53
+ Time.now.strftime('%H:%M:%S')
54
+ end
55
+ end
@@ -0,0 +1,61 @@
1
+ =begin
2
+ Copyright (C) 2007 Stephan Maka <stephan@spaceboyz.net>
3
+ Copyright (C) 2011 Musy Bite <musybite@gmail.com>
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ =end
18
+
19
+ require 'socksify'
20
+ require 'net/http'
21
+
22
+ module Net
23
+ class HTTP
24
+ def self.SOCKSProxy(p_host, p_port)
25
+ delta = SOCKSProxyDelta
26
+ proxyclass = Class.new(self)
27
+ proxyclass.send(:include, delta)
28
+ proxyclass.module_eval {
29
+ include delta::InstanceMethods
30
+ extend delta::ClassMethods
31
+ @socks_server = p_host
32
+ @socks_port = p_port
33
+ }
34
+ proxyclass
35
+ end
36
+
37
+ module SOCKSProxyDelta
38
+ module ClassMethods
39
+ def socks_server
40
+ @socks_server
41
+ end
42
+
43
+ def socks_port
44
+ @socks_port
45
+ end
46
+ end
47
+
48
+ module InstanceMethods
49
+ if RUBY_VERSION[0..0] >= '2'
50
+ def address
51
+ TCPSocket::SOCKSConnectionPeerAddress.new(self.class.socks_server, self.class.socks_port, @address)
52
+ end
53
+ else
54
+ def conn_address
55
+ TCPSocket::SOCKSConnectionPeerAddress.new(self.class.socks_server, self.class.socks_port, address())
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bachue-socksify
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephan Maka
8
+ - Andrey Kouznetsov
9
+ - Christopher Thorpe
10
+ - Musy Bite
11
+ - Yuichi Tateno
12
+ - David Dollar
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2014-10-27 00:00:00.000000000 Z
17
+ dependencies: []
18
+ description:
19
+ email: stephan@spaceboyz.net
20
+ executables:
21
+ - socksify_ruby
22
+ extensions: []
23
+ extra_rdoc_files:
24
+ - doc/index.css
25
+ - doc/index.html
26
+ - COPYING
27
+ files:
28
+ - COPYING
29
+ - bin/socksify_ruby
30
+ - doc/index.css
31
+ - doc/index.html
32
+ - lib/socksify.rb
33
+ - lib/socksify/debug.rb
34
+ - lib/socksify/http.rb
35
+ homepage: http://socksify.rubyforge.org/
36
+ licenses: []
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project: socksify
54
+ rubygems_version: 2.2.2
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Redirect all TCPSockets through a SOCKS5 proxy
58
+ test_files: []