Module: FFWD::Plugin::Tunnel

Includes:
Logging, FFWD::Plugin
Defined in:
lib/ffwd/plugin/tunnel/version.rb,
lib/ffwd/plugin/tunnel/bind_tcp.rb,
lib/ffwd/plugin/tunnel/bind_udp.rb,
lib/ffwd/plugin/tunnel/connection_tcp.rb,
lib/ffwd/plugin/tunnel/binary_protocol.rb,
lib/ffwd/plugin/tunnel.rb

Defined Under Namespace

Classes: BinaryProtocol, BindTCP, BindUDP, ConnectionTCP

Constant Summary collapse

VERSION =
"0.4.7"
DEFAULT_HOST =
'localhost'
DEFAULT_PORT =
9000
DEFAULT_PROTOCOL =
'tcp'
DEFAULT_PROTOCOL_TYPE =
'text'
CONNECTIONS =
{
  :tcp => ConnectionTCP
}

Class Method Summary collapse

Class Method Details

.setup_input(config) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ffwd/plugin/tunnel.rb', line 40

def self.setup_input config
  config[:host] ||= DEFAULT_HOST
  config[:port] ||= DEFAULT_PORT
  config[:protocol] ||= DEFAULT_PROTOCOL

  protocol = FFWD.parse_protocol config[:protocol]

  unless connection = CONNECTIONS[protocol.family]
    raise "No connection for protocol family: #{protocol.family}"
  end

  protocol.bind config, log, connection
end