Class: Shadowsocks::Local::ServerConnector

Inherits:
Tunnel
  • Object
show all
Defined in:
lib/shadowsocks/local.rb

Constant Summary

Constants inherited from Connection

Connection::BackpressureLevel

Instance Attribute Summary

Attributes inherited from Tunnel

#server

Attributes inherited from Connection

#crypto

Instance Method Summary collapse

Methods inherited from Tunnel

#initialize, #remote, #unbind

Constructor Details

This class inherits a constructor from Shadowsocks::Tunnel

Instance Method Details

#post_initObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/shadowsocks/local.rb', line 4

def post_init
  p "connecting #{server.remote_addr[3..-1]} via #{server.config.server}"
  addr_to_send = server.addr_to_send.clone

  send_data encrypt(addr_to_send)
  server.cached_pieces.each { |piece| send_data encrypt(piece) }
  server.cached_pieces = []

  server.stage = 5
end

#receive_data(data) ⇒ Object



15
16
17
18
# File 'lib/shadowsocks/local.rb', line 15

def receive_data data
  server.send_data decrypt(data)
  outbound_scheduler
end