Module: UDPProxy

Defined in:
lib/udp_proxy/client.rb,
lib/udp_proxy.rb,
lib/udp_proxy/server.rb

Overview

TODO: periodically kill all dead connections

Defined Under Namespace

Classes: Client, Clients, Server

Class Method Summary collapse

Class Method Details

.start(ip, port, relay_ip, relay_port) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/udp_proxy.rb', line 8

def self.start(ip, port, relay_ip, relay_port)
	start_logger

  EM::run do
    Syslog.notice "Starting proxy on: #{ip}:#{port}"
    EM::open_datagram_socket ip, port, UDPProxy::Server, ip, relay_ip, relay_port
    trap("TERM") { stop }
    trap("INT") { stop }
  end
end

.stopObject



19
20
21
22
# File 'lib/udp_proxy.rb', line 19

def self.stop
  Syslog.warning "Stopping proxy..."
  EventMachine.stop
end