Sha256: 3647328b5fcaa5ccb4f1c000f33078517576bcc81400ac5961a40518ea8db28c

Contents?: true

Size: 884 Bytes

Versions: 3

Compression:

Stored size: 884 Bytes

Contents

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

        def process_first_packet
          address_bin = packet_protocol.udp_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.udp_receive_from_localbackend(-1)
          plexer.packet_protocol.udp_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/udp/localbackend_connection.rb
shadowsocks_ruby-0.1.1 lib/shadowsocks_ruby/connections/udp/localbackend_connection.rb
shadowsocks_ruby-0.1.0 lib/shadowsocks_ruby/connections/udp/localbackend_connection.rb