Class: ShadowsocksRuby::Connections::UDP::ClientConnection
- Inherits:
-
ServerConnection
- Object
- EventMachine::Connection
- Connection
- ServerConnection
- ShadowsocksRuby::Connections::UDP::ClientConnection
- Defined in:
- lib/shadowsocks_ruby/connections/udp/client_connection.rb
Overview
A ClientConnection’s job is relay data from client to remoteserver.
Constant Summary
Constants inherited from Connection
Instance Attribute Summary
Attributes inherited from ServerConnection
Attributes inherited from Connection
Instance Method Summary collapse
-
#initialize(protocol_stack, params, backend_protocol_stack, backend_params) ⇒ Connection_Object
constructor
If clild class override initialize, make sure to call super.
- #process_first_packet ⇒ Object (also: #process_hook)
- #process_other_packet ⇒ Object
Methods inherited from ServerConnection
#create_plexer, #post_init, #unbind
Methods inherited from Connection
#async_recv, #async_recv_until, #peer, #send_data, #unbind
Constructor Details
#initialize(protocol_stack, params, backend_protocol_stack, backend_params) ⇒ Connection_Object
If clild class override initialize, make sure to call super
9 10 11 |
# File 'lib/shadowsocks_ruby/connections/udp/client_connection.rb', line 9 def initialize protocol_stack, params, backend_protocol_stack, backend_params super end |
Instance Method Details
#process_first_packet ⇒ Object Also known as: process_hook
13 14 15 16 17 18 19 20 |
# File 'lib/shadowsocks_ruby/connections/udp/client_connection.rb', line 13 def process_first_packet address_bin = packet_protocol.udp_receive_from_client(-1) create_plexer(@params[:host], @params[:port], RemoteServerConnection) plexer.packet_protocol.udp_send_to_remoteserver address_bin class << self alias process_hook process_other_packet end end |
#process_other_packet ⇒ Object
25 26 27 28 |
# File 'lib/shadowsocks_ruby/connections/udp/client_connection.rb', line 25 def process_other_packet data = packet_protocol.udp_receive_from_client(-1) plexer.packet_protocol.udp_send_to_remoteserver(data) end |