Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Extract dns_parser.rs as stand-alone crate. #282

Closed
rasheedsulayman opened this issue Dec 9, 2024 · 13 comments
Closed

Comments

@rasheedsulayman
Copy link

rasheedsulayman commented Dec 9, 2024

I have a use-case for a tiny DNS client (service-discovery only) for some wasm targets. The problem is that the socket-related libraries (Socket2, if-addrs) used by this crate can't be compiled to those wasm targets yet. i.e Those libraries simply don't have the system call bindings for the targets. As a result of this, I'm just using the the DNS parser utility file from this crate.

I thought the dns parser utility is useful enough to stand alone as an independent crate.

An easier alternative would to just make this "mdns-sd" crate expose the dns_parser.rs file publicly, but again, other crates that depend on mdns-sd just for the dns parsing functionality would still need to be able to compile Socket2 and if-addrs.

So the request to extract dns_parser.rs as stand-alone crate. I'm also available to work on this if needed, but most importantly, I wanted to hear your opinion on it.

@keepsimple1
Copy link
Owner

I didn't realize that the dns_parser file itself is useful for others. Thanks for raising this issue! Usually I'd like to have related things built together with less dependencies, but let me think a bit more about this. And for my curiosity, may I ask what socket/networking crate do you use for wasm targets? (or did you roll your own for sockets?)

@rasheedsulayman
Copy link
Author

rasheedsulayman commented Dec 10, 2024

Thanks. I'm not using any crate. Yes, I'm writing my own unsafe ffi bindings for the socket system calls.

@keepsimple1
Copy link
Owner

Cool! I thought about it and I think it's worth doing it. I'll give it a shot this weekend and get back to you.

@rasheedsulayman
Copy link
Author

Thanks.

@keepsimple1
Copy link
Owner

keepsimple1 commented Dec 15, 2024

I posted the first version of a PR #284 for this. I think there are quite a bit more details to iron out, but would you please give it a try (using the PR's branch) to see if it would work for your use case? Any comments are appreciated.

EDIT: and one particular thing I wanted to do is: keep the public API surface of the new crate as small as possible (at this initial moment), as long as it can provide service to mdns-sd and your use case.

@rasheedsulayman
Copy link
Author

rasheedsulayman commented Dec 15, 2024

I have checked. It looks good to me. Just one nitpick comment.

I was also able to use the newly extracted mdns-parser, so the exposed public APIs are sufficient for my need.

@keepsimple1
Copy link
Owner

Thanks! I've rebased this patch to the latest release 0.13.0 and addressed comments. I will get the diff ready for merging and publishing the new crate, and I plan to do it in a new release specific for this.

@rasheedsulayman
Copy link
Author

rasheedsulayman commented Dec 18, 2024

When is the release is likely going to be? i.e when the extracted crate will be available on crate.io.

@keepsimple1
Copy link
Owner

When is the release is likely going to be? i.e when the extracted crate will be available on crate.io.

I plan to publish it this week.

@rasheedsulayman
Copy link
Author

Alright thanks.

@keepsimple1
Copy link
Owner

The extracted crate is published :) at https://crates.io/crates/mdns-parser

Let me know if any issues, cheers!

@rasheedsulayman
Copy link
Author

I've tried the crate directly, all good. Thanks for prompt response.

@keepsimple1
Copy link
Owner

A heads-up, after some time, this change didn't feel right to me. I've opened a new PR #297 to rolllback. Sorry about that. Please feel free to fork or create a new crate with this parser code if you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants