Class: SocksHandler::UDP
- Inherits:
-
Object
- Object
- SocksHandler::UDP
- Extended by:
- SocksHandler
- Defined in:
- lib/socks_handler/udp.rb
Constant Summary
Constants included from SocksHandler
Class Method Summary collapse
-
.associate_udp(socket, bind_host, bind_port, username = nil, password = nil) ⇒ SocksHandler::UDPSocket
Associates a TCP socket with a UDP connection.
Class Method Details
.associate_udp(socket, bind_host, bind_port, username = nil, password = nil) ⇒ SocksHandler::UDPSocket
Associates a TCP socket with a UDP connection
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/socks_handler/udp.rb', line 27 def associate_udp(socket, bind_host, bind_port, username = nil, password = nil) negotiate(socket, username, password) address, port = send_details(socket, Command::UDP_ASSOCIATE, bind_host, bind_port) SocksHandler::UDPSocket.new.tap do |s| # Use peeraddr instead of address # because we might not be able to access the address directly s.bind(bind_host, bind_port) s.connect_socks_server(socket.peeraddr[3], port) end end |