19 releases

0.7.0 Mar 4, 2024
0.6.2 Dec 23, 2022
0.6.0 Nov 29, 2022
0.3.1 Apr 26, 2022
0.1.6 Jul 29, 2021

#830 in Network programming

Download history 27/week @ 2024-08-03 71/week @ 2024-08-10 21/week @ 2024-08-17 68/week @ 2024-08-24 38/week @ 2024-08-31 34/week @ 2024-09-07 23/week @ 2024-09-14 30/week @ 2024-09-21 109/week @ 2024-09-28 45/week @ 2024-10-05 47/week @ 2024-10-12 70/week @ 2024-10-19 32/week @ 2024-10-26 46/week @ 2024-11-02 21/week @ 2024-11-09 59/week @ 2024-11-16

161 downloads per month
Used in 2 crates

MIT license

18KB
164 lines

Simpdiscover

Simpdiscover is a simple rust crate to facilitate discovery of services within the Local Area network (LAN) using UDP Broadcast datagrams or "beacons".

The 'announcer' of a service could be a process on another machines, or another threads or process on the same machine.

Goals

  • LAN wide detection of named services and what IP they are at
  • Simple to understand and use
  • Small, few dependencies on the library and small memory and cpu footprint
  • Simple beacon format that is easy to use and that doesn't introduce specific file format support into the library

Non-Goals

  • Discovery of services across LANs, WANs, the Web or in the cloud.

Implemented so far

  • BeaconSender struct that can be setup to send beacons:
    • with a specific beacon content String
    • on a specific port
    • with methods to:
      • send forever in a loop at a given time period
      • send just one beacon
  • Simple BeaconListener struct that can be setup to receive beacons:
    • matching a specific message contents
    • with a method that blocks sender and waits until a message is received
      • with an optional timeout value to wait for or None to wait indefinitely
  • Simple 'announce' and 'listen' binaries that use the library as examples
  • A some Doc tests to keep the API docs correct
  • Github Action to build then clippy check then test all

'announce' binary

Run this binary from the repo using cargo run --bin announce or just announce if you have installed the crate with cargo.

It takes an optional command line parameter to specify the String for the beacon message to announce: cargo run --bin announce -- Hello

'listen' binary

Run this binary from the repo using cargo run --bin listen or just listen if you have installed the crate with cargo.

It takes an optional command line parameter to specify the String for the beacon message to wait for before exiting: cargo run --bin listen -- Hello

Future work

I have taken most of my notes on future work and converted them into GitHub issues.

Some are just questions about things I don't understand and would love experts on UDP and rust to explain them to me.

Please comment or start any you are interested in being implemented.

PRs are obviously welcome, if accompanied by some doc comments, doc tests or tests.

Developers

  • Clone/Fork the repo and download:
  • cd into the directory
  • Add changes, add doc comments and/or doc tests and tests.
  • cargo build
  • cargo test
  • cargo clippy -- -D warnings
  • Create a PR
  • Github actions will run the same steps as above
  • I will review and merge

Dependencies

~270KB