Class: FFWD::Plugin::Tunnel::ConnectionTCP
- Inherits:
-
Connection
- Object
- Connection
- FFWD::Plugin::Tunnel::ConnectionTCP
- Includes:
- EM::Protocols::LineText2, Logging
- Defined in:
- lib/ffwd/plugin/tunnel/connection_tcp.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_peer ⇒ Object
-
#initialize(bind, core, config) ⇒ ConnectionTCP
constructor
A new instance of ConnectionTCP.
- #metadata? ⇒ Boolean
- #post_init ⇒ Object
- #receive_binary_data(data) ⇒ Object
- #receive_line(line) ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(bind, core, config) ⇒ ConnectionTCP
Returns a new instance of ConnectionTCP.
29 30 31 32 33 34 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 29 def initialize bind, core, config @bind = bind @core = core @tunnel_protocol = BinaryProtocol @protocol_instance = nil end |
Class Method Details
.plugin_type ⇒ Object
25 26 27 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 25 def self.plugin_type "tunnel_in_tcp" end |
Instance Method Details
#get_peer ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 44 def get_peer peer = get_peername port, ip = Socket.unpack_sockaddr_in(peer) "#{ip}:#{port}" rescue nil end |
#metadata? ⇒ Boolean
62 63 64 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 62 def not @metadata.nil? end |
#post_init ⇒ Object
52 53 54 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 52 def post_init @protocol_instance = @tunnel_protocol.new @core, self end |
#receive_binary_data(data) ⇒ Object
40 41 42 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 40 def receive_binary_data data @protocol_instance.receive_binary_data data end |
#receive_line(line) ⇒ Object
36 37 38 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 36 def receive_line line @protocol_instance.receive_line line end |
#unbind ⇒ Object
56 57 58 59 60 |
# File 'lib/ffwd/plugin/tunnel/connection_tcp.rb', line 56 def unbind log.info "Shutting down tunnel connection" @protocol_instance.stop @protocol_instance = nil end |