socksify-ruby icon indicating copy to clipboard operation
socksify-ruby copied to clipboard

threadsafe

Open tigris opened this issue 12 years ago • 3 comments

Would love if this could be threadsafe, often want a few tcp sockets open at same time, some via socks and some not

tigris avatar Aug 29 '12 17:08 tigris

Propose an API.

Then it won't be a long shot for a commit.

astro avatar Aug 29 '12 23:08 astro

@tigris socksify-ruby can do this, altough interface is ugly a bit. It's kind of undocumented feature.

require 'socksify'
addr = TCPSocket::SOCKSConnectionPeerAddress.new("<socks host>", <socks port>, "<peer host>")
s = TCPSocket.new(addr, <peer port>)
# Proceed as usual.

musybite avatar Aug 22 '14 16:08 musybite

Something like this would be nice:

require 'socksify'

# Create a new socksified connection
socksified_connection = Socksify::Connection.new(socks_host: "<socks host>", socks_port: <socks port>, peer_host: "<peer host>", peer_port: <peer port>)

# Use the connection as a regular TCPSocket
socksified_connection.write("data")
response = socksified_connection.read
socksified_connection.close

kornate avatar May 03 '23 19:05 kornate