Version: v0.12.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2021 License: Apache-2.0, MIT, Apache-2.0, MIT Imports: 2 Imported by: 1



Package introspection is EXPERIMENTAL. It is subject to heavy change, and it WILL change. For now, it is the simplest implementation to power the proof-of-concept of the libp2p introspection framework.

Package introspect contains the abstract skeleton of the introspection system of go-libp2p, and holds the introspection data schema.



This section is empty.


This section is empty.


This section is empty.


type Endpoint

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

	// Sessions returns the ongoing sessions of this endpoint.
	Sessions() []*Session

Endpoint is the interface to be implemented by introspection endpoints.

An introspection endpoint makes introspection data accessible to external consumers, over, for example, WebSockets, or TCP, or libp2p itself.


type Introspector

type Introspector interface {

	// FetchRuntime returns the runtime information of the system.
	FetchRuntime() (*pb.Runtime, error)

	// FetchFullState returns the full state cross-cut of the running system.
	FetchFullState() (*pb.State, error)

	// EventChan returns the channel where all eventbus events are dumped,
	// decorated with their corresponding event metadata, ready to send over
	// the wire.
	EventChan() <-chan *pb.Event

	// EventMetadata returns the metadata of all events known to the
	// Introspector.
	EventMetadata() []*pb.EventType

Introspector is the interface to be satisfied by components that are capable of spelunking the state of the system, and representing in accordance with the introspection schema.

It's very rare to build a custom implementation of this interface; it exists mostly for mocking. In most cases, you'll end up using the default introspector.

Introspector implementations are usually injected in introspection endpoints to serve the data to clients, but they can also be used separately for embedding or testing.


type Session

type Session struct {
	// RemoteAddr is the remote address of the session.
	RemoteAddr string

Session represents an introspection session.


Path Synopsis
Package introspection/pb contains the protobuf definitions and objects for that form the libp2p introspection protocol.
Package introspection/pb contains the protobuf definitions and objects for that form the libp2p introspection protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL