diff --git a/src/fsm.rs b/src/fsm.rs index 9ee6661..8cb739a 100644 --- a/src/fsm.rs +++ b/src/fsm.rs @@ -168,10 +168,27 @@ impl FSM { let services = self.services.read().unwrap(); match question.qtype { - QueryType::A | QueryType::AAAA | QueryType::All + QueryType::A | QueryType::AAAA if question.qname == *services.get_hostname() => { builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL); + }, + QueryType::All => { + // A / AAAA + builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL); + // PTR + builder = Self::handle_service_type_enumeration(question, services.into_iter(), builder); + for svc in services.find_by_type(&question.qname) { + builder = svc.add_ptr_rr(builder, DEFAULT_TTL); + builder = svc.add_srv_rr(services.get_hostname(), builder, DEFAULT_TTL); + builder = svc.add_txt_rr(builder, DEFAULT_TTL); + builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL); + } + // SRV + if let Some(svc) = services.find_by_name(&question.qname) { + builder = svc.add_srv_rr(services.get_hostname(), builder, DEFAULT_TTL); + builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL); + } } QueryType::PTR => { builder =