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

#589 in Network programming

Download history 75/week @ 2024-04-01 31/week @ 2024-04-08 80/week @ 2024-04-15 42/week @ 2024-04-22 26/week @ 2024-04-29 69/week @ 2024-05-06 38/week @ 2024-05-13 76/week @ 2024-05-20 43/week @ 2024-05-27 47/week @ 2024-06-03 33/week @ 2024-06-10 43/week @ 2024-06-17 30/week @ 2024-06-24 23/week @ 2024-07-01 36/week @ 2024-07-08 29/week @ 2024-07-15

122 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

~255KB