Class: Shadowsocks::Listener

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

Constant Summary

Constants inherited from Connection

Connection::BackpressureLevel

Instance Attribute Summary collapse

Attributes inherited from Connection

#crypto

Instance Method Summary collapse

Instance Attribute Details

#addr_to_sendObject

Returns the value of attribute addr_to_send.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def addr_to_send
  @addr_to_send
end

#cached_piecesObject

Returns the value of attribute cached_pieces.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def cached_pieces
  @cached_pieces
end

#configObject

Returns the value of attribute config.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def config
  @config
end

#connectorObject

Returns the value of attribute connector.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def connector
  @connector
end

#header_lengthObject

Returns the value of attribute header_length.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def header_length
  @header_length
end

#remote_addrObject

Returns the value of attribute remote_addr.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def remote_addr
  @remote_addr
end

#remote_portObject

Returns the value of attribute remote_port.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def remote_port
  @remote_port
end

#stageObject

Returns the value of attribute stage.



3
4
5
# File 'lib/shadowsocks/listener.rb', line 3

def stage
  @stage
end

Instance Method Details

#post_initObject



11
12
13
14
15
# File 'lib/shadowsocks/listener.rb', line 11

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

#receive_data(data) ⇒ Object



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

def receive_data data
  data_handler data
  outbound_checker if connector
end

#remoteObject



22
23
24
# File 'lib/shadowsocks/listener.rb', line 22

def remote
  connector
end

#unbindObject



17
18
19
20
# File 'lib/shadowsocks/listener.rb', line 17

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