Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do you plan to implement SOCKS support? #7

Open
senid231 opened this issue Dec 4, 2015 · 6 comments
Open

do you plan to implement SOCKS support? #7

senid231 opened this issue Dec 4, 2015 · 6 comments

Comments

@senid231
Copy link

senid231 commented Dec 4, 2015

maybe we can use SOCKSSocket instead of Socket or implement it (looks like it is not so difficult)

@reidmorrison
Copy link
Owner

After the refactor in master this should not be hard to do at all.

The hardest part is writing the tests. It would need a test server in Ruby that it can run tests against, including failover. Or figure out a test setup we can run in Travis.

As a last resort we could mock/stub the low level calls for testing. I did find https://github.com/rascov/RubySOCKS that could help.

Any ideas on how we can test this, or do you have any Ruby examples?

@senid231
Copy link
Author

senid231 commented Dec 6, 2015

As first step i want to rewrite tests on rspec.
i think we can use RubySOCKS server for testing

@reidmorrison
Copy link
Owner

The re-factoring of master has settled down and we can now look at additional support such as SOCKSSocket.

Do you have any thoughts on how we can specify the server host name in the Hash of options that is supplied to the initializer?

client = Net::TCPClient.new(servers: ['server1:2000', 'server2:2000'])

Should we specify the socks server for each "server"?

client = Net::TCPClient.new(servers: ['server1(proxy1:2340):2000', 'server2(proxy1:2340):2000'])

Or specify the Socks server for all servers?

client = Net::TCPClient.new(
  servers: ['server1:2000', 'server2:2000'],
  socks_server: 'proxy1:2340'
)

@reidmorrison
Copy link
Owner

The following should now work, please test it and let me know if it works.

client = Net::TCPClient.new(
  server:       'server1:2000',
  proxy_server: 'proxy1:2340'
)

@kornate
Copy link

kornate commented Jul 15, 2021

Hey @reidmorrison! Thank you for the awesome tool. know it's been 5 years and this has gone untested, but it doesn't work.

Can you think of an easy fix, without rewriting the server param implementation to split host and port?

With your example:

from /usr/local/rvm/gems/ruby-2.7.4/gems/net_tcp_client-2.2.0/lib/net/tcp_client/tcp_client.rb:564:in initialize'

If I require 'resolv-replace':

from /usr/local/rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/resolv-replace.rb:14:in rescue in getaddress'
Caused by Resolv::ResolvError: no address for 1.73.63.15:80
from /usr/local/rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/resolv.rb:94:in getaddress'```

@reidmorrison
Copy link
Owner

Any takers to help create a pull request to solve the above issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants