Class: SSLGate::RawServer

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/ssl_gate/raw_gate.rb

Direct Known Subclasses

RawServerAll

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ RawServer

Returns a new instance of RawServer.



38
39
40
# File 'lib/ssl_gate/raw_gate.rb', line 38

def initialize(config)
  @config = config
end

Class Attribute Details

.add_onsObject

Returns the value of attribute add_ons.



31
32
33
# File 'lib/ssl_gate/raw_gate.rb', line 31

def add_ons
  @add_ons
end

Class Method Details

.start(config) ⇒ Object



34
35
36
# File 'lib/ssl_gate/raw_gate.rb', line 34

def self.start(config)
  EventMachine.start_server (config[:bind_interface] || '0.0.0.0'), config[:bind_port], self, config
end

Instance Method Details

#post_initObject



42
43
44
45
46
# File 'lib/ssl_gate/raw_gate.rb', line 42

def post_init
  @queue = EM::Queue.new
  uri = URI.parse @config[:target]
  EM.connect uri.host, uri.port, RawClient, @queue, self
end

#receive_data(data) ⇒ Object



48
49
50
# File 'lib/ssl_gate/raw_gate.rb', line 48

def receive_data(data)
  @queue.push data
end

#unbindObject



52
53
54
# File 'lib/ssl_gate/raw_gate.rb', line 52

def unbind
  @queue.push nil
end