Skip to content

vi/udpexchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

udpexchange

This program follows the following algorithm:

  1. Listen UDP socket at specified address
  2. For each incoming UDP datagram, remember source address in LRU cache
  3. Return empty datagrams back to sender (pings/keepalives)
  4. Forward non-empty datagrams to each known unexpired address (except of sender).

Optionally, it can remember some recent messages and send them to newly seen clients.

Security

This service may allow DDoS amplification, so should not be run publicly.

Small executable size

This project is partly an experiment to create small executables using Rust while having (partial?) access to libstd and using reasonable command-line arguments parser.

cargo build --release -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort --target=x86_64-unknown-linux-musl --features=mini

should produce a working 51-kilobyte executable.

Note that hacks activated by --features=mini may be unsound and less portable. Even smaller size is attainable by also using eyra.

Installation

Download a pre-built executable from Github releases or install from source code with cargo install --path . or cargo install udpexchange.

CLI options

udpexchange --help output
Usage: udpexchange <listen_addr> [-t <timeout>] [-r]

Simple UDP service which replies to all other known clients

Positional Arguments:
  listen_addr       socket address to bind UDP to

Options:
  -t, --timeout     timeout, in seconds, to expire clients.
  -r, --replay      send recent accumulated messages to newly seen clients
  --help            display usage information

About

Small tool to resend received UDP datagrams back to known unexpired addresses; also small executable demo.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages