module ShadowsocksRuby::Connections::TCP::ClientConnection

Mixed-in with an EventMachine::Connection Object to use this.

Public Class Methods

new(protocol_stack, params, backend_protocol_stack, backend_params) click to toggle source

(see ServerConnection#initialize) @option params [String] :host shadowsocks server address, required @option params [Integer] :port shadowsocks server port, required

# File lib/shadowsocks_ruby/connections/tcp/client_connection.rb, line 20
def initialize protocol_stack, params, backend_protocol_stack, backend_params
  super
end

Public Instance Methods

process_first_packet() click to toggle source
# 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
Also aliased as: process_hook
process_hook()

This is Called by process loop

process_other_packet() click to toggle source
# 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