socksify-with-auth 1.7.1

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) && @@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,71 @@
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, p_username = nil, p_password = nil)
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
+ @socks_username = p_username
34
+ @socks_password = p_password
35
+ }
36
+ proxyclass
37
+ end
38
+
39
+ module SOCKSProxyDelta
40
+ module ClassMethods
41
+ def socks_server
42
+ @socks_server
43
+ end
44
+
45
+ def socks_port
46
+ @socks_port
47
+ end
48
+
49
+ def socks_username
50
+ @socks_username
51
+ end
52
+
53
+ def socks_password
54
+ @socks_password
55
+ end
56
+ end
57
+
58
+ module InstanceMethods
59
+ if RUBY_VERSION[0..0] >= '2'
60
+ def address
61
+ TCPSocket::SOCKSConnectionPeerAddress.new(self.class.socks_server, self.class.socks_port, @address, self.class.socks_username, self.class.socks_password)
62
+ end
63
+ else
64
+ def conn_address
65
+ TCPSocket::SOCKSConnectionPeerAddress.new(self.class.socks_server, self.class.socks_port, address(), self.class.socks_username, self.class.socks_password)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: socksify-with-auth
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.1
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: 2018-06-03 00:00:00.000000000 Z
17
+ dependencies: []
18
+ description:
19
+ email: mikesehse@gmail.com
20
+ executables: []
21
+ extensions: []
22
+ extra_rdoc_files:
23
+ - doc/index.html
24
+ - doc/index.css
25
+ - COPYING
26
+ files:
27
+ - COPYING
28
+ - doc/index.css
29
+ - doc/index.html
30
+ - lib/socksify.rb
31
+ - lib/socksify/debug.rb
32
+ - lib/socksify/http.rb
33
+ homepage: http://socksify.rubyforge.org/
34
+ licenses:
35
+ - Ruby
36
+ - GPL-3.0
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:
54
+ rubygems_version: 2.6.8
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Fork of socksify gem to use with auth (gem created to avoid windows bundler
58
+ issues)
59
+ test_files: []