-
Notifications
You must be signed in to change notification settings - Fork 106
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
Added RoutedHost #153
Added RoutedHost #153
Conversation
libp2p/__init__.py
Outdated
|
||
# TODO enable support for other host type | ||
# TODO routing unimplemented | ||
host = BasicHost(swarm_opt) | ||
host = RoutedHost(swarm_opt, disc_opt) |
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 think we should still provide the option for only starting a BasicHost. Can we only return a BasicHost if no disc_opt is passed in and a RoutedHost only when a disc_opt is introduced?
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.
Fixed!
libp2p/kademlia/routed_host.py
Outdated
def get_kad_network(self): | ||
return self.kad_network | ||
|
||
def kad_listen(self, port, interface='0.0.0.0'): |
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.
Should we call these functions routed_listen instead of kad_listen since kademlia is not the only way to do routing.
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.
Fixed!
Hey folks, we're moving away from the specialised host construction in go-libp2p towards a service-based host construction wired with dependency injection and IoC (inversion of control). See: libp2p/go-libp2p#467. With the modular dialer, instead of wrapping a host within a RoutedHost, attaching a DHT to the host with a peer discovery capability would inject a component in the dialer to resolve addrs from the DHT when a dial is carried out. |
Thanks for the heads up @raulk! We will add refactoring this PR using dependency injection and IoC to the roadmap. We should have this done in the next few days! |
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.
Codecov went down because initialize_default_kademlia
is not called in the latest commit. Will land this PR and then open a new one to refactor dependency injection in RoutedHost. Most tests should be added if Codecov is still below expectation.
As per #150, implement RoutedHost