class PacketThief::Handlers::SSLTransparentProxy::SSLProxyConnection

Represents a connection out to the original destination.

Attributes

closed[RW]

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.

connected[RW]

Boolean that represents whether the connection has connected yet.

Public Class Methods

new(tcpsocket, client_conn, ctx) click to toggle source

Sets up references to the client proxy connection handler that created this handler.

# 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

Public Instance Methods

receive_data(data) click to toggle source

Transmit data sent by the destinaton to the client.

# File lib/packetthief/handlers/ssl_transparent_proxy.rb, line 40
def receive_data(data)
  @client.dest_recv(data)
end
tls_failed_handshake(e) click to toggle source
# File lib/packetthief/handlers/ssl_transparent_proxy.rb, line 35
def tls_failed_handshake(e)
  @client.dest_handshake_failed(e)
end
tls_successful_handshake() click to toggle source

send on successful handshake instead of on post_init.

# File lib/packetthief/handlers/ssl_transparent_proxy.rb, line 30
def tls_successful_handshake
  @client.dest_connected
  @client._send_buffer
end
unbind() click to toggle source

Start the closing process and close the other connection if it is not already closing.

# 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