checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: 20779fdc722ec62c9848c063c0bf45d193416ca00bf23dba037b269373d2dd70
4
- data.tar.gz: b78b5f2aebe1f68dcc203e15016de6b15b177469691ca84f804b2dab0db0c0b1
3
+ metadata.gz: cb07bd5b043baa9c23a210d3b69a63bfa1a4659b21431402aa52cf4def01a3aa
4
+ data.tar.gz: e99b79f9638840da4aeda3dc8991482ebe2c5f2f91ad262596c7c2d3b7ee9107
5
5
SHA512:
6
- metadata.gz: 9e9bfd0b8f4d312145f447112bb5d38117a7f0a931d00ada6f7c67acee3e435df43f26ee70808ac7a26aa293e6779a868e17ac15889a75fe03e18a0bc0bff05e
7
- data.tar.gz: 7dbe4518954dcd94b1db56c9f7b08e32e99d95fb490009b1d9f562ba1dac4c973e3a7223cd97fa97dd2379dde2ff4ba1a457b6fccd55fb5907a39c932b68974f
6
+ metadata.gz: d31e65816117bd0bb460098f0f694d3ca3663b04f67054b44577ae76dc27cdec8b3fa1ba8944616ee5282a94c55a53577100fdcaeac7e076907cb1e91fd62e18
7
+ data.tar.gz: 9aa60e5d9fa736118e394292a12f185864de809ba8335add50f5ad1885c993c1b4c84476b1a8d7b2c395a814da7d580b4a43474cc9b8f3805181fad6b489045e
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rspec_status ADDED
@@ -0,0 +1,3 @@
1
+ example_id | status | run_time |
2
+ ---------------------------- | ------ | --------------- |
3
+ ./spec/socket_spec.rb[1:1:1] | passed | 0.04133 seconds |
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
5
5
# Specify your gem's dependencies in dress_socks.gemspec
6
6
gemspec
7
+
8
+ gem "pry", "~> 0.12.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dress_socks (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ diff-lcs (1.3)
11
+ method_source (0.9.2)
12
+ pry (0.12.2)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.9.0)
15
+ rake (10.5.0)
16
+ rspec (3.9.0)
17
+ rspec-core (~> 3.9.0)
18
+ rspec-expectations (~> 3.9.0)
19
+ rspec-mocks (~> 3.9.0)
20
+ rspec-core (3.9.0)
21
+ rspec-support (~> 3.9.0)
22
+ rspec-expectations (3.9.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.9.0)
25
+ rspec-mocks (3.9.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.9.0)
28
+ rspec-support (3.9.0)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ bundler (~> 1.17)
35
+ dress_socks!
36
+ pry (~> 0.12.2)
37
+ rake (~> 10.0)
38
+ rspec (~> 3.0)
39
+
40
+ BUNDLED WITH
41
+ 1.17.3
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
# DressSocks
2
2
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dress_socks`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A pure ruby implementation of SOCKSSocket, allowing tunneling a socket through a SOCKS proxy.
4
4
5
- TODO: Delete this and the text above, and describe your gem
5
+ Based heavily on Socksify, we needed more flexibility in how we setup the tcp connection and only setting it up for certain pieces of code.
6
6
7
7
## Installation
8
8
@@ -22,7 +22,9 @@ Or install it yourself as:
22
22
23
23
## Usage
24
24
25
- TODO: Write usage instructions here
25
+ DressSocks::Socket.new(remote_host, remote_port, socks_username: nil, socks_password: nil, socks_server: nil, socks_port: nil, socks_ignore: [], socks_version: '5')
26
+
27
+ Creates a new TCP Socket that tunnels through the socks configuration passed.
26
28
27
29
## Development
28
30
@@ -32,7 +34,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
34
33
35
## Contributing
34
36
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dress_socks.
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chowly/dress_socks.
36
38
37
39
## License
38
40
data/dress_socks-0.1.0.gem ADDED
Binary file
data/lib/dress_socks.rb CHANGED
@@ -1,6 +1,10 @@
1
+ require "socket"
2
+ require "resolv"
3
+
1
4
require "dress_socks/version"
5
+ require "dress_socks/socket"
6
+ require 'dress_socks/errors'
2
7
3
8
module DressSocks
4
- class Error < StandardError; end
9
+
5
- # Your code goes here...
6
10
end
data/lib/dress_socks/errors.rb ADDED
@@ -0,0 +1,71 @@
1
+ module DressSocks
2
+ class SOCKSError < RuntimeError
3
+ def initialize(msg)
4
+ super
5
+ end
6
+
7
+ class ServerFailure < SOCKSError
8
+ def initialize
9
+ super("general SOCKS server failure")
10
+ end
11
+ end
12
+ class NotAllowed < SOCKSError
13
+ def initialize
14
+ super("connection not allowed by ruleset")
15
+ end
16
+ end
17
+ class NetworkUnreachable < SOCKSError
18
+ def initialize
19
+ super("Network unreachable")
20
+ end
21
+ end
22
+ class HostUnreachable < SOCKSError
23
+ def initialize
24
+ super("Host unreachable")
25
+ end
26
+ end
27
+ class ConnectionRefused < SOCKSError
28
+ def initialize
29
+ super("Connection refused")
30
+ end
31
+ end
32
+ class TTLExpired < SOCKSError
33
+ def initialize
34
+ super("TTL expired")
35
+ end
36
+ end
37
+ class CommandNotSupported < SOCKSError
38
+ def initialize
39
+ super("Command not supported")
40
+ end
41
+ end
42
+ class AddressTypeNotSupported < SOCKSError
43
+ def initialize
44
+ super("Address type not supported")
45
+ end
46
+ end
47
+
48
+ def self.for_response_code(code)
49
+ case code
50
+ when 1
51
+ ServerFailure
52
+ when 2
53
+ NotAllowed
54
+ when 3
55
+ NetworkUnreachable
56
+ when 4
57
+ HostUnreachable
58
+ when 5
59
+ ConnectionRefused
60
+ when 6
61
+ TTLExpired
62
+ when 7
63
+ CommandNotSupported
64
+ when 8
65
+ AddressTypeNotSupported
66
+ else
67
+ self
68
+ end
69
+ end
70
+ end
71
+ end
data/lib/dress_socks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
module DressSocks
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: dress_socks
3
3
version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
platform: ruby
6
6
authors:
7
7
- Justin McNally
8
8
autorequire:
9
9
bindir: exe
10
10
cert_chain: []
11
- date: 2019-12-01 00:00:00.000000000 Z
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
12
dependencies:
13
13
- !ruby/object:Gem::Dependency
14
14
name: bundler
@@ -60,15 +60,20 @@ executables: []
60
60
extensions: []
61
61
extra_rdoc_files: []
62
62
files:
63
+ - ".rspec"
64
+ - ".rspec_status"
63
65
- Changelog.md
64
66
- Gemfile
67
+ - Gemfile.lock
65
68
- LICENSE.txt
66
69
- README.md
67
70
- Rakefile
68
71
- bin/console
69
72
- bin/setup
73
+ - dress_socks-0.1.0.gem
70
74
- dress_socks.gemspec
71
75
- lib/dress_socks.rb
76
+ - lib/dress_socks/errors.rb
72
77
- lib/dress_socks/version.rb
73
78
homepage: https://github.com/chowly/dress_socks
74
79
licenses: