-
Notifications
You must be signed in to change notification settings - Fork 25
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
add no-strict feature to ignore InvalidDirectives #18
base: main
Are you sure you want to change the base?
Conversation
Fix for hickory-dns#17 It's sometimes desireable to ignore invalid directives so that the supplied configuration can still be used. This change adds a feature flag `no-strict` that when enabled, does not return an `Err(InvalidDirective(_))` when a directive isn't valid. Instead, it skips over it, allowing the configuration to be used.
Hm, can we make it a runtime feature rather than compile-time? |
@tailhook I suppose it could be implemented as a runtime feature. However that presents the problem of propagating such behavior up to dependent crates (such as https://github.com/bluejekyll/trust-dns). Implementing the switch at compile time gives the end user the ability to control the behavior, regardless of how this crate is used. Of course I'm biased toward the decision of compile time for this reason, but I'd expect this leads less configuration overall |
What's your specific use case? Do you put custom stuff into the resolv-conf? Or is it some directive on exotic system is not implemented? |
There is a third use case... Most / all other software that uses |
Just a third-party opinion: while being strict about parsing is quite useful (and very much in line with the Rust ecosystem), I also feel like defaulting to matching existing tools in some amount of liberty makes sense. I think it makes sense to make this optional at runtime, but default to being more liberal. (Whatever is decided here, as a trust-dns maintainer I'm fine with exposing some API in trust-dns to allow access to useful runtime options.) |
@tailhook, what problem do you hope to solve by making strict a run-time option? |
From the top of my head:
|
That said I think it would be cool if would look like this:
I.e. something similar to how mutex poisoning work, where you can recover original value from error object. |
It would. But that does not solve the problem presented by @philgebhardt. The application developer has determined that ignoring |
…xclusive. Inverting the the [no-]strict feature means that strict is the option and we no longer need to include a feature when building agent.
Fix for #17
It's sometimes desireable to ignore invalid directives so that the
supplied configuration can still be used. This change adds a feature
flag
no-strict
that when enabled, does not return anErr(InvalidDirective(_))
when a directive isn't valid. Instead, itskips over it, allowing the configuration to be used.