Class: ShadowsocksRuby::Protocols::PlainProtocol

Inherits:
Object
  • Object
show all
Includes:
DummyHelper
Defined in:
lib/shadowsocks_ruby/protocols/packet/plain.rb

Overview

Relay data from peer to plexer without any process. This is a packet protocol, so no need to implement @buffer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DummyHelper

#async_recv, #raise_me, #send_data

Constructor Details

#initialize(params = {}) ⇒ PlainProtocol

Returns a new instance of PlainProtocol.

Parameters:

  • params (Hash) (defaults to: {})

    Configuration parameters


11
12
13
# File 'lib/shadowsocks_ruby/protocols/packet/plain.rb', line 11

def initialize params = {}
  @params = {}.merge(params)
end

Instance Attribute Details

#next_protocolObject

Returns the value of attribute next_protocol


8
9
10
# File 'lib/shadowsocks_ruby/protocols/packet/plain.rb', line 8

def next_protocol
  @next_protocol
end

Instance Method Details

#tcp_receive_from_destination(n) ⇒ Object


15
16
17
# File 'lib/shadowsocks_ruby/protocols/packet/plain.rb', line 15

def tcp_receive_from_destination n
  async_recv n
end

#tcp_send_to_destination(data) ⇒ Object


19
20
21
# File 'lib/shadowsocks_ruby/protocols/packet/plain.rb', line 19

def tcp_send_to_destination data
  send_data data
end

#udp_receive_from_destination(n) ⇒ Object


23
24
25
# File 'lib/shadowsocks_ruby/protocols/packet/plain.rb', line 23

def udp_receive_from_destination n
  async_recv n
end

#udp_send_to_destination(data) ⇒ Object


27
28
29
# File 'lib/shadowsocks_ruby/protocols/packet/plain.rb', line 27

def udp_send_to_destination data
  send_data data
end