pub struct SimpleDiscovery { /* private fields */ }Expand description
Simple service discovery with sensible defaults
Implementations§
Source§impl SimpleDiscovery
impl SimpleDiscovery
Sourcepub async fn new() -> Result<Self>
pub async fn new() -> Result<Self>
Create a new simple discovery instance with defaults
Automatically configures:
- mDNS protocol
- Common service types (_http._tcp, _https._tcp, _ssh._tcp, _ftp._tcp)
- 5-second timeout
- Service verification enabled
§Example
use auto_discovery::simple::SimpleDiscovery;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let discovery = SimpleDiscovery::new().await?;
let services = discovery.discover_all().await?;
println!("Found {} services", services.len());
Ok(())
}Sourcepub async fn discover_all(&self) -> Result<Vec<ServiceInfo>>
pub async fn discover_all(&self) -> Result<Vec<ServiceInfo>>
Discover all configured services
Sourcepub async fn discover_http(&self) -> Result<Vec<ServiceInfo>>
pub async fn discover_http(&self) -> Result<Vec<ServiceInfo>>
Discover only HTTP services
Sourcepub async fn register_http_service(&self, name: &str, port: u16) -> Result<()>
pub async fn register_http_service(&self, name: &str, port: u16) -> Result<()>
Register a simple HTTP service
§Example
let discovery = SimpleDiscovery::new().await?;
discovery.register_http_service("My Web App", 8080).await?;Auto Trait Implementations§
impl Freeze for SimpleDiscovery
impl !RefUnwindSafe for SimpleDiscovery
impl Send for SimpleDiscovery
impl Sync for SimpleDiscovery
impl Unpin for SimpleDiscovery
impl !UnwindSafe for SimpleDiscovery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more