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

allow overwriting builtin dual DHT options #688

Merged
merged 2 commits into from
Aug 25, 2020
Merged

allow overwriting builtin dual DHT options #688

merged 2 commits into from
Aug 25, 2020

Conversation

petar
Copy link
Contributor

@petar petar commented Aug 20, 2020

Needed by tests to disable things like diversity filters for WANs.

@petar petar requested a review from aschmahmann August 20, 2020 21:31
dual/dual.go Outdated
if wan.Mode() != dht.ModeClient {
lanOpts = append(lanOpts, dht.Mode(dht.ModeServer))
cfg.lan = append([]dht.Option{dht.Mode(dht.ModeServer)}, cfg.lan...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not flip this to be cfg.lan = append (cfg.lan, DHT.Mode(dht.ModeServer)?

Copy link
Contributor

Choose a reason for hiding this comment

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

For example, users can reasonably expect to pass dht.Mode(dht.ModeAuto) into the constructor. Appending this after ModeServer will mean that we start the LAN DHT in ModeAuto which is bad.

I get the desire to have user options trump the default options. Maybe we need a ForceWAN() and ForceLAN() option or something to figure out when a user really wants to clobber the defaults.

@aschmahmann aschmahmann merged commit 6e04c48 into master Aug 25, 2020
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
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.

2 participants