use crate::{EventLoop, NetworkInterface, Result, ServiceType, TxtRecord};
use std::any::Any;
use std::sync::Arc;
pub trait TMdnsBrowser {
fn new(service_type: ServiceType) -> Self;
fn set_network_interface(&mut self, interface: NetworkInterface);
fn set_service_discovered_callback(
&mut self,
service_discovered_callback: Box<ServiceDiscoveredCallback>,
);
fn set_context(&mut self, context: Box<dyn Any>);
fn browse_services(&mut self) -> Result<EventLoop>;
}
pub type ServiceDiscoveredCallback = dyn Fn(Result<ServiceDiscovery>, Option<Arc<dyn Any>>);
#[derive(
Debug, Getters, Builder, BuilderDelegate, Serialize, Deserialize, Clone, PartialEq, Eq,
)]
pub struct ServiceDiscovery {
name: String,
service_type: ServiceType,
domain: String,
host_name: String,
address: String,
port: u16,
txt: Option<TxtRecord>,
}