Sha256: 560f1ba0290b2d98eaf18a99743c637384f3d682749dc2ec38c79389ed2033e0

Contents?: true

Size: 884 Bytes

Versions: 3

Compression:

Stored size: 884 Bytes

Contents

module ShadowsocksRuby
  module Connections
    module TCP
      # (see TCP::ClientConnection)
      module LocalBackendConnection
        include ShadowsocksRuby::Connections::Connection
        include ShadowsocksRuby::Connections::ServerConnection

        def process_first_packet
          address_bin = packet_protocol.tcp_receive_from_localbackend(-1)
          host, port = Util::parse_address_bin(address_bin)
          create_plexer(host, port, DestinationConnection)
          class << self
            alias process_hook process_other_packet
          end
        end

        # (see TCP::ClientConnection#process_hook)
        alias process_hook process_first_packet

        def process_other_packet
          data = packet_protocol.tcp_receive_from_localbackend(-1)
          plexer.packet_protocol.tcp_send_to_destination(data)
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shadowsocks_ruby-0.1.2 lib/shadowsocks_ruby/connections/tcp/localbackend_connection.rb
shadowsocks_ruby-0.1.1 lib/shadowsocks_ruby/connections/tcp/localbackend_connection.rb
shadowsocks_ruby-0.1.0 lib/shadowsocks_ruby/connections/tcp/localbackend_connection.rb