class PacketThief::Impl::Manual

PacketThief implementation that does apply any firewall rules. Furthermore, ::original_dest will always return a pre-configured destination address.

Public Class Methods

original_dest(sock) click to toggle source

Returns the [port, host] for the original destination of sock.

The Manual implementation only returns a preconfigured original destination. Making it only good for testing clients that only talk to a single remote host.

# File lib/packetthief/impl/manual.rb, line 45
def self.original_dest(sock)
  raise "You must call .set_dest(host,port) to set the original_dest in the Manual PacketThief implementation!" if @dest_host == nil or @dest_port == nil
  return [ @dest_port, @dest_host ]

end
redirect(args={}) click to toggle source
# File lib/packetthief/impl/manual.rb, line 30
def self.redirect(args={})
  rule = NullRule.new(self)
  rule.redirect(args)
end
set_dest(host, port) click to toggle source
# File lib/packetthief/impl/manual.rb, line 35
def self.set_dest(host, port)
  @dest_host = host
  @dest_port = port
end