Class: FFWD::Plugin::Tunnel::BindUDP

Inherits:
Object
  • Object
show all
Defined in:
lib/ffwd/plugin/tunnel/bind_udp.rb

Defined Under Namespace

Classes: Handle

Instance Method Summary collapse

Constructor Details

#initialize(port, family, tunnel, block) ⇒ BindUDP

Returns a new instance of BindUDP.



33
34
35
36
37
38
# File 'lib/ffwd/plugin/tunnel/bind_udp.rb', line 33

def initialize port, family, tunnel, block
  @port = port
  @family = family
  @tunnel = tunnel
  @block = block
end

Instance Method Details

#data!(addr, data) ⇒ Object



44
45
46
47
# File 'lib/ffwd/plugin/tunnel/bind_udp.rb', line 44

def data! addr, data
  handle = Handle.new self, addr
  @block.call handle, data
end

#send_data(addr, data) ⇒ Object



40
41
42
# File 'lib/ffwd/plugin/tunnel/bind_udp.rb', line 40

def send_data addr, data
  @tunnel.send_data Socket::SOCK_DGRAM, @family, @port, addr, data
end