Module: ShadowsocksRuby::Connections::TCP::ClientConnection
- Includes:
- Connection, ServerConnection
- Defined in:
- lib/shadowsocks_ruby/connections/tcp/client_connection.rb
Overview
Mixed-in with an EventMachine::Connection Object to use this.
Constant Summary
Constants included from Connection
Instance Attribute Summary
Attributes included from ServerConnection
Attributes included from Connection
Instance Method Summary collapse
-
#initialize(protocol_stack, params, backend_protocol_stack, backend_params) ⇒ Connection_Object
If clild class override initialize, make sure to call super.
- #process_first_packet ⇒ Object (also: #process_hook)
- #process_other_packet ⇒ Object
Methods included from ServerConnection
Methods included from Connection
#async_recv, #async_recv_until, #peer, #send_data, #unbind
Instance Method Details
#initialize(protocol_stack, params, backend_protocol_stack, backend_params) ⇒ Connection_Object
If clild class override initialize, make sure to call super
20 21 22 |
# File 'lib/shadowsocks_ruby/connections/tcp/client_connection.rb', line 20 def initialize protocol_stack, params, backend_protocol_stack, backend_params super end |
#process_first_packet ⇒ Object Also known as: process_hook
24 25 26 27 28 29 30 31 |
# File 'lib/shadowsocks_ruby/connections/tcp/client_connection.rb', line 24 def process_first_packet address_bin = packet_protocol.tcp_receive_from_client(-1) create_plexer(@params[:host], @params[:port], RemoteServerConnection) plexer.packet_protocol.tcp_send_to_remoteserver address_bin class << self alias process_hook process_other_packet end end |
#process_other_packet ⇒ Object
36 37 38 39 |
# File 'lib/shadowsocks_ruby/connections/tcp/client_connection.rb', line 36 def process_other_packet data = packet_protocol.tcp_receive_from_client(-1) plexer.packet_protocol.tcp_send_to_remoteserver(data) end |