zre: ZRE protocol implementation

[ bsd3, library, networking, program ] [ Propose Tags ]

Peer-to-peer local area networking with reliable group messaging and automatic peer discovery. ZRE protocol implementation according to https://rfc.zeromq.org/spec:36/ZRE/


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
examples

Builds example applications

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.1.0, 0.1.2.0, 0.1.3.0, 0.1.4.0, 0.1.5.0, 0.1.5.1
Change log CHANGELOG.md
Dependencies async, attoparsec (>=0.14 && <0.15), base (>=4 && <5), binary (>=0.8), bytestring, cereal, containers, data-default, directory, filepath, lifted-async, lifted-base, monad-control, mtl, network (>=3.1 && <3.2), network-bsd (>=2.8 && <2.9), network-info (>=0.2 && <0.3), network-multicast (>=0.3 && <0.4), optparse-applicative, process, random, repline (>=0.4 && <0.5), sockaddr, stm, text, time, transformers-base, uuid, zeromq4-haskell (>=0.8 && <0.9), zre [details]
License BSD-3-Clause
Copyright 2020 Richard Marko
Author Richard Marko
Maintainer srk@48.io
Category Networking
Home page https://github.com/sorki/haskell-zre/
Source repo head: git clone https://github.com/sorki/haskell-zre
Uploaded by srk at 2023-11-28T05:56:55Z
Distributions NixOS:0.1.5.1
Executables zrecat, zretime, zrematch, zgossip-server, zreworker, mzre, zre
Downloads 2094 total (35 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-11-28 [all 1 reports]

Readme for zre-0.1.5.1

[back to package description]

zre

GitHub Workflow Status Hackage version Dependencies

ZRE protocol implementation https://rfc.zeromq.org/spec:36/ZRE/

Peer-to-peer local area networking with reliable group messaging and automatic peer discovery.

Usage

Dependencies:

zeromq4

Clone and test

git clone https://github.com/sorki/haskell-zre/
cd haskell-zre
nix-build
./result/bin/zre
# in another terminal or networked computer
./result/bin/zre

Two zre peers should find each other and be able to send message between each other. Firewall needs to allow traffic on UDP port 5670 and TCP port range 41000-41100. Application picks random port from this range and advertises it to network.

Applications

Few applications are provided to get you started:

  • zre - interact and dump events
  • zrecat - cat messages for group

These can be installed locally using pkgs.haskellPackage.zre.

Try running multiple copies of zre and zrecat on the same computer or computers on the local network

zre
# another terminal
zrecat test
# now in original terminal you can join testgroup with
> /join test
# or send messages to it
> /shout test msg

Send uptime periodically to uptime group

( while true; do uptime; sleep 1; done ) | zrecat uptime

Cat file to group

cat /etc/os-release | zrecat test

Interact manually

zre
# in zre shell following commands are supported:
> /join time
> /shout time test!
> /leave time
> /join uptime
> /whisper <uuid> message

ZGossip

Implementation of gossip protocol is included in form of key value TTL server. This allows connecting peers from different networks (or subnets) not reachable via multicast beacon. This service requires TCP port 31337 and can be started with zgossip-server binary.

Run server

zgossip_server

Pass gossip endpoint to apps with

zre -g <gossip_ip>:31337

Configuration

ZRE applications using runZre will automatically try to load configuration file if ZRECFG environment variable points to it. See zre.conf for configuration example::

ZRECFG=./zre.conf zrecat test

To be able to use one config for multiple apps and still be able to distinguish between them you can also set ZRENAME environment variable which overrides name from config or default config if ZRECFG is not used::

ZRENAME=zrenode1 zrecat test

Demos