A simple store-and-forward + flooding daemon with signature verification
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Alain Zscheile d26c73179f
prune unavailable packets from sessions
2 days ago
asn1 send public key with every message 3 days ago
lib prune unavailable packets from sessions 2 days ago
test chore: update usage tutorial 3 days ago
.formatter.exs initial commit 1 week ago
.gitignore first try at persistence 3 days ago
README.md chore: update usage tutorial 3 days ago
mix.exs add logfile backend 2 days ago
mix.lock add logfile backend 2 days ago
shell.nix use erlang R25 4 days ago

README.md

Floof

A simple forwarding + flooding daemon with signature verification

Installation

This package has enacl as a dependency, and thus requires libsodium to be installed in the system/environment. See also the shell.nix for a suitable environment.

If available in Hex, the package can be installed by adding floof to your list of dependencies in mix.exs:

def deps do
  [
    {:floof, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/floof.

Configuration

The config should be written to config/runtime.exs. Adjust the ip addresses below as appropriate.

upstream

import Config

if config_env() == :prod do
  config :floof, listen_opts: [ip: {192,168,0,1}]
  config :floof, spool_dir: ".spool"
  config :floof, sessions_file: ".sessions.dets"
end

downstream

import Config

if config_env() == :prod do
  config :floof, listen_port: nil
  config :floof, spool_dir: ".spool"
  config :floof, sessions_file: ".sessions.dets"

  config :floof,
    upstreams: [
      {{192, 168, 0, 1}, 2540,
       <<"randomly-generated-session-key">>}
    ]
end

Manually emitting a message

Build a release using mix release. Then run/start the server using _build/prod/rel/floof/bin/floof start.

Log into a running floof process (e.g. using _build/prod/rel/floof/bin/floof remote)

# generate and save a keypair
kp = :enacl.sign_keypair()
:ok = File.write("test01.ed25519k", kp.secret)

# send a message
{:ok, secret} = File.read("test01.ed25519k")
msg_topic = [{:RelativeDistinguishedName, {2, 5, 4, 41}, "test topic"}]
msg_inner = Floof.Message.pack_inner(msg_topic, [], :info, <<0, 0>>)
msg_outer = Floof.Message.build_outer(255, [], secret, msg_inner)
Floof.Message.emit(msg_outer)