8000 GitHub - wooga/reconnaissance
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 29, 2020. It is now read-only.

wooga/reconnaissance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

reconnaissance

reconnaissance is a small Erlang application for node discovery in a local network.

Building

git clone git@github.com:wooga/reconnaissance.git
cd reconnaissance
./rebar com

Usage

reconnaissance comes preconfigured with a callback module that sends the host, port and node name:

When started twice with erl -pz ebin -s reconnaissance you can use reconnaissance:discover(). to find other nodes also having reconaissance running:

reconnaissance:discover().
[{{172,19,255,43},63616,<<"nonode@nohost">>}]

Here is the build-in callback module:

% Creates the payload that is sent as multicast packet
request() ->
    <<"hello">>.

% Request is the payload from the request() function above
% The output is the response payload
response(_IP, _Port, Request) ->
    list_to_binary(atom_to_list(node())).

% Called when the response from discoverd nodes is received 
% Output will be stored in the node list
handle_response(IP, Port, Response) ->
    {IP, Port, Response}.

The API calls are:

  1. reconnaissance:discover/0 meaning "find other nodes, wait half a second for responses and give me the list"
  2. reconnaissance:discover/1 use a server name other than reconnaissance
  3. reconnaissance:discover/2 also specify the time to wait in ms.

Et voilá: reconnaissance!

Configuration

Use in the environment:

{reconnaissance, [
    {port, 31337},
    {callback_module, reconnaissance_example_callback}
]}

Make sure multicast is routed propery by the OS:

sudo route add 224.0.0.1 10.8.0.3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0