balliegojr/simple-dns

unable to get instance name in instance information

Closed this issue · 4 comments

unable to get instance name in instance information

I am thinking about changing the get_known_services to return a HashMap<String, InstanceInformation>, where the key would be the instance name, would that solve the issue?

    pub fn get_known_services(&self) -> HashMap<String, InstanceInformation> {

That would be great. But even more I'd prefer to get a stream of discovered services and cache them myself.

Hi, I've made a few changes in this commit to add a notification channel.

the TL;DR; of the change is the one bellow (the async version uses a tokio channel)

pub fn new_with_scope(
        instance_name: &str,
        service_name: &str,
        resource_ttl: u32,
        on_discovery: Option<std::sync::mpsc::Sender<(String, InstanceInformation)>>,
        network_scope: NetworkScope,
    ) -> Result<Self, SimpleMdnsError>

Please let me know if this will solve your use case

works great! thanks!