Class: BetterCap::Proxy::UDP::Client
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- BetterCap::Proxy::UDP::Client
- Defined in:
- lib/bettercap/proxy/udp/pool.rb
Instance Attribute Summary collapse
-
#client_ip ⇒ Object
Returns the value of attribute client_ip.
-
#client_port ⇒ Object
Returns the value of attribute client_port.
Instance Method Summary collapse
-
#initialize(client_ip, client_port, server) ⇒ Client
constructor
A new instance of Client.
-
#receive_data(data) ⇒ Object
upstream -> ip.
Constructor Details
#initialize(client_ip, client_port, server) ⇒ Client
Returns a new instance of Client.
21 22 23 24 |
# File 'lib/bettercap/proxy/udp/pool.rb', line 21 def initialize(client_ip, client_port, server) @client_ip, @client_port = client_ip, client_port @server = server end |
Instance Attribute Details
#client_ip ⇒ Object
Returns the value of attribute client_ip.
19 20 21 |
# File 'lib/bettercap/proxy/udp/pool.rb', line 19 def client_ip @client_ip end |
#client_port ⇒ Object
Returns the value of attribute client_port.
19 20 21 |
# File 'lib/bettercap/proxy/udp/pool.rb', line 19 def client_port @client_port end |
Instance Method Details
#receive_data(data) ⇒ Object
upstream -> ip
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bettercap/proxy/udp/pool.rb', line 27 def receive_data(data) port, ip = Socket.unpack_sockaddr_in(get_peername) event = Event.new( ip, port, data ) Logger.info "[#{'UDP PROXY'.green}] #{'upstream'.yellow}:#{@server.relay_port} #{'->'.green} #{ip} ( #{event.data.bytesize} bytes )" Module.dispatch( 'on_response', event ) @server.send_datagram( event.data, client_ip, client_port ) end |