-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Filter Interface Addresses #936
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably need to listen for 'local addresses changed' events to invalidate the cached default source addresses.
The local address change event will happen when the libp2p node starts listening on a new address. Please can you explain why the default source address we get from the |
I think the point is that if you get a new interface (connect to wifi, plug in an ethernet cable) it'll affect both the OS routing table / default route, and the addresses libp2p believes it is listening on. It seems reasonable to want this view of 'our current source address' to reflect the OS's view of its default route. |
@Stebalien @willscott I think it looks much better now. Please take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can get away with just running updateLocalIPAddr
when emitAddrChange
occurs. Presumably the irregular poll of h.Addrs()
, which should pick up changed external addresses, will also vary in the same 5 minute interval as local addresses changed, so that might be a good enough signal directly, and remove the need for the extra event loop complexity.
Let me reason through this so I can clear my head as well: The
|
ping @Stebalien for one last review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM but I really think the extra goroutine+channel makes this harder to read.
@Stebalien Have made the change. |
@Stebalien @willscott
For #911 .