Crate searchlight

source ·
Expand description

📡 Searchlight

Searchlight is an mDNS server & client library designed to be simple, lightweight and easy to use, even if you just have basic knowledge about mDNS.

In layman’s terms, Searchlight is a library for broadcasting and discovering “services” on a local network. This technology is part of the same technology used by Chromecast, AirDrop, Phillips Hue, and et cetera.

Searchlight is designed with user interfaces in mind. The defining feature of this library is that it keeps track of the presence of services on the network, and notifies you when they come and go, allowing you to update your user interface accordingly, providing a user experience that is responsive, intuitive and familiar to a scanning list for WiFi, Bluetooth, Chromecast, etc.

  • 🌐 IPv4 and IPv6 - Support for both IPv4 and IPv6.
  • ✨ OS support - Support for Windows, macOS and most UNIX systems.
  • 📡 Broadcasting - Send out service announcements to the network and respond to discovery requests. (mDNS server)
  • 👽 Discovery - Discover services on the network and keep track of their presence. (mDNS client)
  • 🧵 Single threaded - Searchlight operates on just a single thread, thanks to the Tokio async runtime & task scheduler.
  • 🤸 Flexible API - No async, no streams, no channels, no bullsh*t. Just provide an event handler function and bridge the gap between your application and Searchlight however you like.
  • 👻 Background runtime - Discovery and broadcasting can both run in the background on separate threads, providing a handle to gracefully shut down if necessary.
  • 📨 UDP - All networking, including discovery and broadcasting, is connectionless and done over UDP.
  • 🔁 Loopback - Support for receiving packets sent by the same socket, intended to be used in tests.
  • 🎯 Interface targeting - Support for targeting specific network interface(s) for discovery and broadcasting.

Feature flags

  • broadcast ᵈᵉᶠᵃᵘˡᵗ
    Provides the Broadcaster type that will broadcast Services on the network and respond to discovery requests.

  • discovery ᵈᵉᶠᵃᵘˡᵗ
    Provides the Discovery type that will discover Responders on the network and keep track of their presence, notifying you via DiscoveryEvents.

Examples

Examples for broadcasting and discovery can be found in the documentation for their respective modules.

Re-exports

Modules

  • broadcastbroadcast
    mDNS Broadcasting
  • discoverydiscovery
    mDNS Discovery
  • Errors that can occur when using this crate
  • Networking utilities and abstractions

Constants