Class: ShadowsocksRuby::Protocols::NoIvCipherProtocol
- Inherits:
-
Object
- Object
- ShadowsocksRuby::Protocols::NoIvCipherProtocol
- Includes:
- DummyHelper
- Defined in:
- lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb
Overview
To be used with protocols without an IV, like Cipher::Table
Instance Attribute Summary collapse
-
#next_protocol ⇒ Object
Returns the value of attribute next_protocol.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ NoIvCipherProtocol
constructor
A new instance of NoIvCipherProtocol.
- #tcp_receive_from_localbackend(n) ⇒ Object
- #tcp_receive_from_remoteserver(n) ⇒ Object
- #tcp_send_to_localbackend(data) ⇒ Object
- #tcp_send_to_remoteserver(data) ⇒ Object
Methods included from DummyHelper
#async_recv, #raise_me, #send_data
Constructor Details
#initialize(params = {}) ⇒ NoIvCipherProtocol
Returns a new instance of NoIvCipherProtocol.
12 13 14 |
# File 'lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb', line 12 def initialize params = {} @cipher = params[:cipher] or raise ProtocolError, "params[:cipher] is required" end |
Instance Attribute Details
#next_protocol ⇒ Object
Returns the value of attribute next_protocol.
8 9 10 |
# File 'lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb', line 8 def next_protocol @next_protocol end |
Instance Method Details
#tcp_receive_from_localbackend(n) ⇒ Object
24 25 26 |
# File 'lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb', line 24 def tcp_receive_from_localbackend n @cipher.decrypt(async_recv n) end |
#tcp_receive_from_remoteserver(n) ⇒ Object
16 17 18 |
# File 'lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb', line 16 def tcp_receive_from_remoteserver n @cipher.decrypt(async_recv n) end |
#tcp_send_to_localbackend(data) ⇒ Object
28 29 30 |
# File 'lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb', line 28 def tcp_send_to_localbackend data send_data(@cipher.encrypt data) end |
#tcp_send_to_remoteserver(data) ⇒ Object
20 21 22 |
# File 'lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb', line 20 def tcp_send_to_remoteserver data send_data(@cipher.encrypt data) end |