Sha256: 48157c7cbb15a398c35a9595327a793ae4ff2698ac4458b5e9cc72927cf2856f

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require 'envoy/protocol'
require 'envoy/client/channel'

module Envoy
  module Client
  
    module Trunk
      include Protocol
      
      attr_reader :options
      
      def initialize options
        @options = options
      end
      
      def channels
        @channels ||= {}
      end
      
      def receive_start_tls
        start_tls
      end
      
      def receive_close id
        channels[id].close_connection true
        channels.delete(id)
      end
      
      def receive_stream id, data
        channels[id].send_data data
      end
      
      def receive_connection id
        channels[id] = EM.connect(options[:local_host] || '127.0.0.1',
                                  options[:local_port], Channel, id, self)
      end
      
      def receive_keepalive
      end
      
      def receive_message message
        STDERR.puts message
      end
      
      def receive_halt
        EventMachine.stop_event_loop
      end
      
      def unbind
        EM.stop_event_loop
      end
      
      def ssl_handshake_completed
        o = options.dup
        o.delete(:local_host)
        send_object :options, o
      end
      
      def post_init
        send_object :start_tls
      end
      
    end
  
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
envoy-proxy-0.0.7 lib/envoy/client/trunk.rb
envoy-proxy-0.0.6 lib/envoy/client/trunk.rb
envoy-proxy-0.0.5 lib/envoy/client/trunk.rb
envoy-proxy-0.0.4 lib/envoy/client/trunk.rb
envoy-proxy-0.0.2 lib/envoy/client/trunk.rb
envoy-proxy-0.0.1 lib/envoy/client/trunk.rb