class ShadowsocksRuby::Protocols::NoIvCipherProtocol

To be used with protocols without an IV, like {Cipher::Table}

Attributes

next_protocol[RW]

Public Class Methods

new(params = {}) click to toggle source

@param [Hash] configuration parameters @option params [Cipher::Table] :cipher a cipher object without IV, required

# 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

Public Instance Methods

tcp_receive_from_localbackend(n) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/shadowsocks_ruby/protocols/cipher/no_iv_cipher.rb, line 20
def tcp_send_to_remoteserver data
  send_data(@cipher.encrypt data)
end