Class: PacketThief::Handlers::SSLTransparentProxy::SSLProxyConnection
- Inherits:
-
PacketThief::Handlers::SSLClient
- Object
- EM::Connection
- AbstractSSLHandler
- PacketThief::Handlers::SSLClient
- PacketThief::Handlers::SSLTransparentProxy::SSLProxyConnection
- Defined in:
- lib/packetthief/handlers/ssl_transparent_proxy.rb
Overview
Represents a connection out to the original destination.
Instance Attribute Summary collapse
-
#closed ⇒ Object
Boolean that represents whether this handler has started to close/unbind.
-
#connected ⇒ Object
Boolean that represents whether the connection has connected yet.
Attributes inherited from AbstractSSLHandler
#ctx, #sni_hostname, #sslsocket, #tcpsocket
Instance Method Summary collapse
-
#initialize(tcpsocket, client_conn, ctx) ⇒ SSLProxyConnection
constructor
Sets up references to the client proxy connection handler that created this handler.
-
#receive_data(data) ⇒ Object
Transmit data sent by the destinaton to the client.
- #tls_failed_handshake(e) ⇒ Object
-
#tls_successful_handshake ⇒ Object
send on successful handshake instead of on post_init.
-
#unbind ⇒ Object
Start the closing process and close the other connection if it is not already closing.
Methods inherited from PacketThief::Handlers::SSLClient
Methods inherited from AbstractSSLHandler
#close_connection, #close_connection_after_writing, #notify_readable, #notify_writable, #post_init, #send_data, #tls_begin, #write_buffer, #write_buffer=
Methods included from Logging
Constructor Details
#initialize(tcpsocket, client_conn, ctx) ⇒ SSLProxyConnection
Sets up references to the client proxy connection handler that created this handler.
19 20 21 22 23 24 25 26 27 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 19 def initialize(tcpsocket, client_conn, ctx) super(tcpsocket) @client = client_conn @ctx = ctx @connected = false @closed = false sni_hostname = @client.dest_hostname if @client.dest_hostname end |
Instance Attribute Details
#closed ⇒ 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.
12 13 14 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 12 def closed @closed end |
#connected ⇒ Object
Boolean that represents whether the connection has connected yet.
15 16 17 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 15 def connected @connected end |
Instance Method Details
#receive_data(data) ⇒ Object
Transmit data sent by the destinaton to the client.
40 41 42 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 40 def receive_data(data) @client.dest_recv(data) end |
#tls_failed_handshake(e) ⇒ Object
35 36 37 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 35 def tls_failed_handshake(e) @client.dest_handshake_failed(e) end |
#tls_successful_handshake ⇒ Object
send on successful handshake instead of on post_init.
30 31 32 33 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 30 def tls_successful_handshake @client.dest_connected @client._send_buffer end |
#unbind ⇒ Object
Start the closing process and close the other connection if it is not already closing.
46 47 48 49 50 51 |
# File 'lib/packetthief/handlers/ssl_transparent_proxy.rb', line 46 def unbind @client.dest_closed self.closed = true @client.dest = nil @client.close_connection_after_writing if @client and not @client.closed end |