mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-04-09 15:00:11 +08:00
add an introspection.Endpoint interface.
This commit is contained in:
parent
a448afcc2c
commit
c109bc7f90
14
host/host.go
14
host/host.go
@ -76,12 +76,14 @@ type Host interface {
|
||||
}
|
||||
|
||||
// IntrospectableHost is implemented by Host implementations that are
|
||||
// introspectable, that is, that expose an introspection server.
|
||||
// introspectable, that is, that may have introspection capability.
|
||||
type IntrospectableHost interface {
|
||||
|
||||
// Introspector returns the introspection.Introspector instance, with which
|
||||
// the caller can:
|
||||
// - register data providers.
|
||||
// - fetch introspection data.
|
||||
// Introspector the introspector, or nil if one hasn't been registered. With
|
||||
// it, the call can register data providers, and can fetch introspection
|
||||
// data.
|
||||
Introspector() introspection.Introspector
|
||||
|
||||
// IntrospectionEndpoint returns the introspection endpoint, or nil if one
|
||||
// hasn't been registered.
|
||||
IntrospectionEndpoint() introspection.Endpoint
|
||||
}
|
||||
|
20
introspection/endpoint.go
Normal file
20
introspection/endpoint.go
Normal file
@ -0,0 +1,20 @@
|
||||
package introspection
|
||||
|
||||
// Endpoint is the interface to be implemented by introspection
|
||||
// endpoints/servers.
|
||||
//
|
||||
// An introspection endpoint exposes introspection data over the wire via a
|
||||
// protocol and data format, e.g. WebSockets with Protobuf.
|
||||
type Endpoint interface {
|
||||
// Start starts the introspection endpoint. It must only be called once, and
|
||||
// once the server is started, subsequent calls made without first calling
|
||||
// Close will error.
|
||||
Start() error
|
||||
|
||||
// Close stops the introspection endpoint. Calls to Close on an already
|
||||
// closed endpoint, or an unstarted endpoint, must noop.
|
||||
Close() error
|
||||
|
||||
// ListenAddrs returns the listen addresses of this endpoint.
|
||||
ListenAddrs() []string
|
||||
}
|
Loading…
Reference in New Issue
Block a user