Module: ShadowsocksRuby::Connections::UDP::ClientConnection
- Includes:
- Connection, ServerConnection
- Defined in:
- lib/shadowsocks_ruby/connections/udp/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
19 20 21 |
# File 'lib/shadowsocks_ruby/connections/udp/client_connection.rb', line 19 def initialize protocol_stack, params, backend_protocol_stack, backend_params super end |
#process_first_packet ⇒ Object Also known as: process_hook
23 24 25 26 27 28 29 30 |
# File 'lib/shadowsocks_ruby/connections/udp/client_connection.rb', line 23 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
35 36 37 38 |
# File 'lib/shadowsocks_ruby/connections/udp/client_connection.rb', line 35 def process_other_packet data = packet_protocol.udp_receive_from_client(-1) plexer.packet_protocol.udp_send_to_remoteserver(data) end |