Sha256: 53b331581ef4a5dbe4aeb3c0fc1529692efe08e7434b98f8c330cb4df06235d8
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
module RProxy class TargetConnection < EM::Connection def initialize(client, disable_cb, buffer_size, unbind) @disable_unbind_callback = disable_cb @client_connection = client @buffer_size = buffer_size @unbind_service = unbind end def assign_logger(logger) @logger = logger end def assign_user_and_password(username, password) @username = username @password = password end def connection_completed response_proxy_connect_ready end def proxy_target_unbound close_connection end def unbind return if @disable_unbind_callback @unbind_service.call(@username, @password, get_proxied_bytes) end private def response_proxy_connect_ready begin @client_connection.send_data(RProxy::Constants::HTTP_SUCCESS) @client_connection.proxy_incoming_to(self, @buffer_size) proxy_incoming_to(@client_connection, @buffer_size) rescue => e port, ip = Socket.unpack_sockaddr_in(get_peername) @logger.error("target ip: #{ip}, port: #{port}, #{e.message}") if @logger end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
r_proxy-0.1.1 | lib/r_proxy/target_connection.rb |
r_proxy-0.1.0 | lib/r_proxy/target_connection.rb |