When using a libp2p host with routing, the underlying concrete type is RoutedHost. This type wraps the original Host type and hides it into a private field, which makes it hard to make interface type assertions on the host.
E.g. sometimes it's useful to have access to the underlying instance of the IDService, which is exposed by BasicHost as a method IDService() identityIDService, but is inaccessible for type assertions because RoutedHost hides the BasicHost in its private field.
This commit uses type embedding, instead of a private field, to fix it.
When using a libp2p host with routing, the underlying concrete type is RoutedHost. This type wraps the original Host type and hides it into a private field, which makes it hard to make interface type assertions on the host.
E.g. sometimes it's useful to have access to the underlying instance of the IDService, which is exposed by BasicHost as a method
IDService() identityIDService
, but is inaccessible for type assertions because RoutedHost hides the BasicHost in its private field.This commit uses type embedding, instead of a private field, to fix it.