Module: PacketThief::Handlers::TransparentProxy::ProxyConnection
- Defined in:
- lib/packetthief/handlers/transparent_proxy.rb
Overview
Represents a connection out to the original destination.
Instance Attribute Summary collapse
-
#closing ⇒ Object
Boolean that represents whether this handler has started to close/unbind.
-
#connected ⇒ Object
Boolean that represents whether the connection has connected yet.
Instance Method Summary collapse
-
#initialize(client_conn) ⇒ Object
Sets up references to the client proxy connection handler that created this handler.
- #post_init ⇒ Object
-
#receive_data(data) ⇒ Object
Transmit data sent by the destinaton to the client.
-
#unbind ⇒ Object
Start the closing process and close the other connection if it is not already closing.
Instance Attribute Details
#closing ⇒ Object
Boolean that represents whether this handler has started to close/unbind. Used to ensure there is no unbind-loop between the two connections that make up the proxy.
13 14 15 |
# File 'lib/packetthief/handlers/transparent_proxy.rb', line 13 def closing @closing end |
#connected ⇒ Object
Boolean that represents whether the connection has connected yet.
16 17 18 |
# File 'lib/packetthief/handlers/transparent_proxy.rb', line 16 def connected @connected end |
Instance Method Details
#initialize(client_conn) ⇒ Object
Sets up references to the client proxy connection handler that created this handler.
20 21 22 23 24 25 |
# File 'lib/packetthief/handlers/transparent_proxy.rb', line 20 def initialize(client_conn) @client = client_conn @connected = false @closing = false end |
#post_init ⇒ Object
27 28 29 |
# File 'lib/packetthief/handlers/transparent_proxy.rb', line 27 def post_init @client._send_buffer end |
#receive_data(data) ⇒ Object
Transmit data sent by the destinaton to the client.
32 33 34 |
# File 'lib/packetthief/handlers/transparent_proxy.rb', line 32 def receive_data(data) @client.dest_recv(data) end |
#unbind ⇒ Object
Start the closing process and close the other connection if it is not already closing.
38 39 40 41 42 |
# File 'lib/packetthief/handlers/transparent_proxy.rb', line 38 def unbind @client.dest_closed self.closing = true @client.close_connection_after_writing if @client and not @client.closing end |