Commit 8157087f authored by Steven Allen's avatar Steven Allen

feat: switch to a single routability event

This means we can make the event _stateful_ so subscribing always gives us the
last state.
parent bcf3ad5c
package event
// EvtLocalRoutabilityPrivate is an event struct to be emitted with the local's
// node routability changes to PRIVATE (i.e. not routable from the Internet).
//
// This event is usually emitted by the AutoNAT subsystem.
type EvtLocalRoutabilityPrivate struct{}
// EvtLocalRoutabilityPublic is an event struct to be emitted with the local's
// node routability changes to PUBLIC (i.e. appear to routable from the
// Internet).
//
// This event is usually emitted by the AutoNAT subsystem.
type EvtLocalRoutabilityPublic struct{}
import (
"github.com/libp2p/go-libp2p-core/network"
)
// EvtLocalRoutabilityUnknown is an event struct to be emitted with the local's
// node routability changes to UNKNOWN (i.e. we were unable to make a
// determination about our NAT status with enough confidence).
// EvtLocalRoutability is an event struct to be emitted with the local's node
// routability changes state.
//
// This event is usually emitted by the AutoNAT subsystem.
type EvtLocalRoutabilityUnknown struct{}
type EvtLocalRoutability struct {
Routability network.Routability
}
......@@ -53,6 +53,24 @@ const (
CannotConnect
)
// Routability indicates how reachable a node is.
type Routability int
const (
// RoutabilityUnknown indicates that the routability status is unknown.
RoutabilityUnknown = iota
// RoutabilityPublic indicates that the node is reachable from the
// public internet.
RoutabilityPublic
// RoutabilityPrivate indicates that the node is not reachable from the
// public internet.
//
// NOTE: This node may _still_ be reachable via relays.
RoutabilityPrivate
)
// Stat stores metadata pertaining to a given Stream/Conn.
type Stat struct {
Direction Direction
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment