Method: ShadowsocksRuby::App#start_client

Defined in:
lib/shadowsocks_ruby/app.rb

#start_clientObject



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/shadowsocks_ruby/app.rb', line 147

def start_client
  stack1 = Protocols::ProtocolStack.new([
      ["socks5", {}]
  ], options[:cipher_name], options[:password])

  stack2 = Protocols::ProtocolStack.new([
    get_packet_protocol,
    get_cipher_protocol,
    get_obfs_protocol
  ].compact, options[:cipher_name], options[:password])

  local_args = [
    stack1,
    {:host => options[:server], :port => options[:port]},
    stack2,
    {}
  ]

  start_em options[:local_addr], options[:local_port], Connections::TCP::ClientConnection, local_args
end