From 195228188c9a8b9e458eb3ae06aed3c1ec378efd Mon Sep 17 00:00:00 2001 From: Han Xu Date: Thu, 5 Feb 2026 21:48:01 -0800 Subject: [PATCH] chore: update some comments --- src/dns_parser.rs | 1 + src/service_info.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dns_parser.rs b/src/dns_parser.rs index 7133a4d..7bf56b5 100644 --- a/src/dns_parser.rs +++ b/src/dns_parser.rs @@ -1537,6 +1537,7 @@ impl DnsOutPacket { // // This function also handles RFC 6763 Section 4.3 escaping where dots and backslashes // in instance names are escaped (e.g., "My\\.Service" represents a single label "My.Service"). + // The actual name sent over the wire is the unescaped version. fn write_name(&mut self, name: &str) { // Remove trailing dot if present let name_to_parse = name.strip_suffix('.').unwrap_or(name); diff --git a/src/service_info.rs b/src/service_info.rs index 62427dd..00f86db 100644 --- a/src/service_info.rs +++ b/src/service_info.rs @@ -55,7 +55,9 @@ impl From<&MyIntf> for InterfaceId { /// Escapes dots and backslashes in a DNS instance name according to RFC 6763 Section 4.3. /// - '.' becomes '\.' -/// - '\\' becomes '\\\\' +/// - '\' becomes '\\' +/// +/// Note: `\` itself needs to be escaped in the source code. /// /// This is required when concatenating the three portions of a Service Instance Name /// to ensure that literal dots in the instance name are not interpreted as label separators. @@ -128,6 +130,7 @@ impl ServiceInfo { /// "_my-service._udp.local.". /// /// `my_name` is the instance name, without the service type suffix. + /// It allows dots (`.`) and backslashes (`\`). /// /// `host_name` is the "host" in the context of DNS. It is used as the "name" /// in the address records (i.e. TYPE_A and TYPE_AAAA records). It means that