endpoint.go 949 Bytes
Newer Older
1 2 3 4 5
package introspection

// Endpoint is the interface to be implemented by introspection endpoints.
//
// An introspection endpoint makes introspection data accessible to external
tavit ohanian's avatar
tavit ohanian committed
6
// consumers, over, for example, WebSockets, or TCP, or p2p itself.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
//
// Experimental.
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
}

// Session represents an introspection session.
type Session struct {
	// RemoteAddr is the remote address of the session.
	RemoteAddr string
}