Sha256: edf7f41cd4a09e2f0b8ca50e7acc06e08b4fbb5146721f162cbf6d685e35b678

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

module EventMachine
  module SFlow
    class Collector
      def initialize args = {}
        args[:host] ||= "127.0.0.1"
        args[:port] ||= 6343
        
        @callbacks = []
        @proxy_targets = []
        
        EventMachine.open_datagram_socket(args[:host], args[:port], DatagramHandler, {:host => args[:host], :callbacks => @callbacks, :proxy_targets => @proxy_targets})
      end
      
      def proxy_to target
        @proxy_targets << target
      end
      
      def on_sflow &proc
        @callbacks << proc
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
em-sflow-1.0.3 lib/em-sflow/collector.rb
em-sflow-1.0.2 lib/em-sflow/collector.rb
em-sflow-1.0.1 lib/em-sflow/collector.rb