Class: Shadowsocks::Listener

Inherits:
Connection
  • Object
show all
Includes:
Table
Defined in:
lib/shadowsocks/listener.rb

Constant Summary

Constants inherited from Connection

Connection::BackpressureLevel

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Table

#encrypt, #get_table, #merge, #merge_sort

Methods included from Ext

binary_path

Instance Attribute Details

#addr_to_sendObject

Returns the value of attribute addr_to_send.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def addr_to_send
  @addr_to_send
end

#cached_piecesObject

Returns the value of attribute cached_pieces.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def cached_pieces
  @cached_pieces
end

#configObject

Returns the value of attribute config.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def config
  @config
end

#connectorObject

Returns the value of attribute connector.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def connector
  @connector
end

#header_lengthObject

Returns the value of attribute header_length.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def header_length
  @header_length
end

#remote_addrObject

Returns the value of attribute remote_addr.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def remote_addr
  @remote_addr
end

#remote_portObject

Returns the value of attribute remote_port.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def remote_port
  @remote_port
end

#stageObject

Returns the value of attribute stage.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def stage
  @stage
end

#tableObject

Returns the value of attribute table.



5
6
7
# File 'lib/shadowsocks/listener.rb', line 5

def table
  @table
end

Instance Method Details

#post_initObject



13
14
15
16
17
# File 'lib/shadowsocks/listener.rb', line 13

def post_init
  @stage = 0
  @cached_pieces = []
  puts "A client has connected..."
end

#receive_data(data) ⇒ Object



8
9
10
11
# File 'lib/shadowsocks/listener.rb', line 8

def receive_data data
  data_handler data
  outbound_checker if connector
end

#remoteObject



24
25
26
# File 'lib/shadowsocks/listener.rb', line 24

def remote
  connector
end

#unbindObject



19
20
21
22
# File 'lib/shadowsocks/listener.rb', line 19

def unbind
  puts "A client has left..."
  connection_cleanup
end