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

Refactor osdns to avoid using custom linker flags in common situations #903

Merged
merged 4 commits into from
Sep 11, 2024

Conversation

mmatczuk
Copy link
Contributor

@mmatczuk mmatczuk commented Sep 9, 2024

Rename osdns to dnshack and require dnshack build tag to use it.
This allows to use standard, unmodified Go build chain at the expense of not using custom DNS parameters in dev builds.

@mmatczuk
Copy link
Contributor Author

mmatczuk commented Sep 9, 2024

Fixes #895

dns_dnshack.go Outdated

func (c *DNSConfig) Apply() error {
return dnshack.Configure(c.Servers, c.Timeout, c.RoundRobin)
}
Copy link
Contributor

@Choraden Choraden Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add endl

@Choraden
Copy link
Contributor

Choraden commented Sep 11, 2024

Don't we want to add the tag to every file in the dnshack package?

Maybe not

@mmatczuk
Copy link
Contributor Author

At first I did not want to add it at all here. But it turns out I needed to add them to avoid go test with linker flag. I'd add the build tag everywhere for consistency.

Do not call osdns directly - use forwarder.DNSConfig::Apply() instead.
Refactor osdns::Configure() signature to avoid dependency loop.
Hide Apply() implementation by dnshack build tag.
Require tag to run dnshack tests.
Restore elements of previous commit.
@mmatczuk
Copy link
Contributor Author

Added new line and build tags to all files.

@Choraden
Copy link
Contributor

LGTM

@mmatczuk mmatczuk merged commit 74c4cfe into main Sep 11, 2024
6 checks passed
@mmatczuk mmatczuk deleted the mmt/osdns_hide branch September 11, 2024 09:10
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

Successfully merging this pull request may close these issues.

3 participants