Class: ShadowsocksRuby::Connections::TCP::LocalBackendConnection
- Inherits:
-
ServerConnection
- Object
- EventMachine::Connection
- Connection
- ServerConnection
- ShadowsocksRuby::Connections::TCP::LocalBackendConnection
- Defined in:
- lib/shadowsocks_ruby/connections/tcp/localbackend_connection.rb
Overview
A LocalBackendConnection’s job is relay data from localbackend to destination.
Constant Summary
Constants inherited from Connection
Instance Attribute Summary
Attributes inherited from ServerConnection
Attributes inherited from Connection
Instance Method Summary collapse
- #process_first_packet ⇒ Object (also: #process_hook)
- #process_other_packet ⇒ Object
Methods inherited from ServerConnection
#create_plexer, #initialize, #post_init, #unbind
Methods inherited from Connection
#async_recv, #async_recv_until, #peer, #send_data, #unbind
Constructor Details
This class inherits a constructor from ShadowsocksRuby::Connections::ServerConnection
Instance Method Details
#process_first_packet ⇒ Object Also known as: process_hook
7 8 9 10 11 12 13 14 15 |
# File 'lib/shadowsocks_ruby/connections/tcp/localbackend_connection.rb', line 7 def process_first_packet address_bin = packet_protocol.tcp_receive_from_localbackend(-1) host, port = Util::parse_address_bin(address_bin) logger.info('connection') { "connecting #{host}:#{port} from #{peer}" } create_plexer(host, port, DestinationConnection) class << self alias process_hook process_other_packet end end |
#process_other_packet ⇒ Object
20 21 22 23 |
# File 'lib/shadowsocks_ruby/connections/tcp/localbackend_connection.rb', line 20 def process_other_packet data = packet_protocol.tcp_receive_from_localbackend(-1) plexer.packet_protocol.tcp_send_to_destination(data) end |