Comments (9)
Having TXT records be HashMap<String, String>
is a very nice and logical API.
However, Keys are not utf-8, only printable ascii.
And the Values can be any sequence of bytes (including '='), again not utf-8.
from mdns-sd.
Thanks for the details!
New publish does not have TXT
If start browsing, existing services have TXT record info.
If I publish a service (with avahi-publish-service), the TXT info is missing.
But if I publish BEFORE I start the browse, I do get the TXT info.
This is a bug and worth a separate issue. Would you mind open another issue for it?
from mdns-sd.
However, Keys are not utf-8, only printable ascii.
UTF-8 is backward compatible with ascii. So it's fine to represent ascii using utf-8.
And the Values can be any sequence of bytes (including '='), again not utf-8.
I didn't know that, thanks for pointing it out. Before we change, do you have use cases where you do need to support non-UTF-8 values? I'm trying to see benefit/cost ratio.
from mdns-sd.
For other key/value rules, I agree we should fix the code using this issue.
from mdns-sd.
from mdns-sd.
from mdns-sd.
As far as receiving, yes this is fine. However, publishing should verify that the key has only the allowed characters (0x20 - 0x7e, except for '=').
Good point. I think we can check it in ServiceInfo::new()
.
I don't know of any specifically. Just noticed it while reading the RFC. I would imagine most values are just text, But since the spec allows it, it's probably out there, or will be. Best be prepared to handle it somehow.
Maybe I'm biased, but I think the world is moving towards UTF-8. It is possible that some rare applications use non-UTF-8 in TXT records but I'm willing to postpone this until a concrete case shows up in our context.
(Some other types in Rust ecosystem face / faced the same problem, for example std::path::Path
. IMO, the history shows that supporting non-UTF-8 things in a mostly UTF-8 environment can be costly for the end users.)
Also, the no-key and empty key cases ("key" and "key=") should be distinguished somehow. Maybe with an
Option<>
?
Yes, that sounds good to me. And maybe we can take this opportunity to define a type X for TXT key/value pairs so that ServiceInfo::new()
accepts X
or Option<X>
instead of the plain HashMap<String, String>
. Also, maybe we keep the new()
as is (deprecate it later), and add a new / better constructor for ServiceInfo
, maybe even using Builder pattern or something?
And with a new type for TXT k/v pairs and a new constructor, it might be easier to be flexible in supporting non-UTF-8 values (now or later).
from mdns-sd.
Two of the problems are resolved in their separated issues:
from mdns-sd.
All issues mentioned above are addressed in Release 0.7.0. If any problems, please open a new issue.
Thanks again @dalepsmith for opening this issue and helping solving them. If anything not working properly, please raise them.
from mdns-sd.
Related Issues (20)
- remove busy polling in the service daemon run loop HOT 1
- support some Ipv4Addr methods for IpAddr
- error message from address decoding HOT 1
- Allow the user to disable IPv6 if desired HOT 1
- Malformed mDNS query causes ServiceDaemon to panic HOT 2
- `.browse` for all subservice's HOT 9
- Not consistent shutdowns and no way to know if shut down? HOT 7
- Trouble with query_missing_srv() HOT 5
- check_service_name_length() attempt to subtract with overflow HOT 5
- Updating service info when service is registered HOT 2
- A and AAAA mDNS records HOT 13
- Use `serde` for de/ser Txt Records HOT 4
- Failed to send to ... Resource temporarily unavailable (os error 11) HOT 2
- Received length loss HOT 21
- When a receiver is dropped, the error produced by sender should not be Error HOT 5
- Issues with using a multicast IP for a service HOT 7
- Services published using python-zerconf or systemd-resolved are not resolved HOT 17
- Utility function to resolve mDNS hostnames HOT 7
- Add support for traffic reduction techniques from RFC6762, sec. 7 HOT 1
- Too verbose logging, even when logging is not enabled HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdns-sd.