Sha256: 91b876b8d39454b660e1ae4b5f2e5524fe612417f3e1031667f7794acd3a67c3

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

module Shadowsocks
  module Parser
    class Local < Base
      def addr_type
        data[3]
      end

      def addr_len
        if mode == :domain
          data[4].unpack('c')[0]
        end
      end

      def remote_addr
        case mode
        when :domain
          data[2, addr_len + 3]
        when :ip
          inet_ntoa data[1..4]
        end
      end

      def remote_port
        case mode
        when :domain
          data[5 + addr_len, 2].unpack('s>')[0]
        when :ip
          data[5, 2].unpack('s>')[0]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shadowsocks-0.12 lib/shadowsocks/parser/local.rb
shadowsocks-0.11 lib/shadowsocks/parser/local.rb
shadowsocks-0.10 lib/shadowsocks/parser/local.rb