diagnostics

package
v0.4.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2016 License: MIT Imports: 18 Imported by: 0

README

ipfs diagnostics

Usage:

ipfs diag net [--vis=<vis>]

view in d3

Install https://github.com/jbenet/ipfs-diag-net-d3-vis then:

> ipfs diag net --vis=d3 | d3view
http://ipfs.benet.ai:8080/ipfs/QmX8PuUyhSet8fppZHuRNxG7vk949z7XDxnsAz3zN77MGx#QmdhRqGea2QEzyKHG9Zhkc12d2994iah1h47tfHJifuzhT

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

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

func GetGraphJson(dinfo []*DiagInfo) []byte

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
}

func (*DiagInfo) Marshal

func (di *DiagInfo) Marshal() []byte

Marshal to json

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

func (d *Diagnostics) HandleMessage(ctx context.Context, s inet.Stream) error

type DotWriter

type DotWriter struct {
	W io.Writer
	// contains filtered or unexported fields
}

func (*DotWriter) Write

func (w *DotWriter) Write(buf []byte) (n int, err error)

Write writes a buffer to the internal writer. It handles errors as in: http://blog.golang.org/errors-are-values

func (*DotWriter) WriteEdge

func (w *DotWriter) WriteEdge(i, j int, di *DiagInfo, conn connDiagInfo) error

func (*DotWriter) WriteGraph

func (w *DotWriter) WriteGraph(dinfo []*DiagInfo) error

func (*DotWriter) WriteNetHeader

func (w *DotWriter) WriteNetHeader(dinfo []*DiagInfo) error

func (*DotWriter) WriteNode

func (w *DotWriter) WriteNode(i int, di *DiagInfo) error

func (*DotWriter) WriteS

func (w *DotWriter) WriteS(s string) (n int, err error)

WriteS writes a string

Directories

Path Synopsis
Package diagnostics_pb is a generated protocol buffer package.
Package diagnostics_pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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