Documentation ¶
Overview ¶
package diagnostics implements a network diagnostics service that allows a request to traverse the network and gather information on every node connected to it.
Index ¶
- Constants
- Variables
- func GetGraphJson(dinfo []*DiagInfo) []byte
- type DiagInfo
- type Diagnostics
- type DotWriter
- func (w *DotWriter) Write(buf []byte) (n int, err error)
- func (w *DotWriter) WriteEdge(i, j int, di *DiagInfo, conn connDiagInfo) error
- func (w *DotWriter) WriteGraph(dinfo []*DiagInfo) error
- func (w *DotWriter) WriteNetHeader(dinfo []*DiagInfo) error
- func (w *DotWriter) WriteNode(i int, di *DiagInfo) error
- func (w *DotWriter) WriteS(s string) (n int, err error)
Constants ¶
View Source
const HopTimeoutDecrement = time.Second * 2
View Source
const ResponseTimeout = time.Second * 10
Variables ¶
View Source
var ErrAlreadyRunning = errors.New("diagnostic with that ID already running")
View Source
var ProtocolDiag protocol.ID = "/ipfs/diagnostics"
ProtocolDiag is the diagnostics protocol.ID
Functions ¶
func GetGraphJson ¶
Types ¶
type DiagInfo ¶
type DiagInfo struct { // This nodes ID ID string // A list of peers this node currently has open connections to Connections []connDiagInfo // A list of keys provided by this node // (currently not filled) Keys []string // How long this node has been running for // TODO rename Uptime LifeSpan time.Duration // Incoming Bandwidth Usage BwIn uint64 // Outgoing Bandwidth Usage BwOut uint64 // Information about the version of code this node is running CodeVersion string }
type Diagnostics ¶
type Diagnostics struct {
// contains filtered or unexported fields
}
Diagnostics is a net service that manages requesting and responding to diagnostic requests
func NewDiagnostics ¶
func NewDiagnostics(self peer.ID, h host.Host) *Diagnostics
NewDiagnostics instantiates a new diagnostics service running on the given network
func (*Diagnostics) GetDiagnostic ¶
func (d *Diagnostics) GetDiagnostic(ctx context.Context, timeout time.Duration) ([]*DiagInfo, error)
GetDiagnostic runs a diagnostics request across the entire network
func (*Diagnostics) HandleMessage ¶
type DotWriter ¶
func (*DotWriter) Write ¶
Write writes a buffer to the internal writer. It handles errors as in: http://blog.golang.org/errors-are-values
func (*DotWriter) WriteGraph ¶
func (*DotWriter) WriteNetHeader ¶
Click to show internal directories.
Click to hide internal directories.