Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllPeers ¶
Types ¶
type MeasurementOptions ¶
type MeasurementOptions struct { Count int // Number of measurements to take Interval time.Duration // Interval between measurements PathVer []uint16 }
MeasurementOptions contains options for starting a measurement
type PathPingServer ¶
type PathPingServer struct {
// contains filtered or unexported fields
}
PathPingServer represents a mesh network node capable of forwarding and measuring latency
func NewServer ¶
func NewServer(global *system.Node) *PathPingServer
NewServer returns a new PathPingServer instance with the given config.
The PathPingServer is a singleton and only one instance is created for the entire program. Subsequent calls to NewServer will return the same instance.
The server is configured with the given site ID, port, and buffer size. A logger is also provided which is used to log any errors or messages.
The server is not started until the Start method is called.
func (*PathPingServer) Measure ¶
func (n *PathPingServer) Measure(path []uint16, opts MeasurementOptions) (Result, error)
Measure sends a packet along the given path and measures the round-trip time.
The measurement is repeated 'count' times with an interval of 'interval' between each measurement. The server will return an error if the measurement exceeds the given timeout.
The path must start with the local node ID and must be between 2 and *pathPingMax (default 16) nodes long.
func (*PathPingServer) Start ¶
func (n *PathPingServer) Start() error
Start the PathPingServer and begin listening for incoming packets.
The server is configured to listen on the configured port and IP address and to connect to all other nodes in the mesh network.
The server will start listening for incoming packets and will begin forwarding packets to the next hop.
The server will return an error if it is already started.
func (*PathPingServer) Stop ¶
func (n *PathPingServer) Stop() error