mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-01-16 02:40:08 +08:00
Merge pull request #126 from libp2p/feat/single-routability-event
Switch to a single routability event
This commit is contained in:
commit
d143201d83
13
event/reachability.go
Normal file
13
event/reachability.go
Normal file
@ -0,0 +1,13 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
)
|
||||
|
||||
// EvtLocalReachabilityChanged is an event struct to be emitted when the local's
|
||||
// node reachability changes state.
|
||||
//
|
||||
// This event is usually emitted by the AutoNAT subsystem.
|
||||
type EvtLocalReachabilityChanged struct {
|
||||
Reachability network.Reachability
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
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{}
|
||||
|
||||
// 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).
|
||||
//
|
||||
// This event is usually emitted by the AutoNAT subsystem.
|
||||
type EvtLocalRoutabilityUnknown struct{}
|
@ -53,6 +53,25 @@ const (
|
||||
CannotConnect
|
||||
)
|
||||
|
||||
// Reachability indicates how reachable a node is.
|
||||
type Reachability int
|
||||
|
||||
const (
|
||||
// ReachabilityUnknown indicates that the reachability status of the
|
||||
// node is unknown.
|
||||
ReachabilityUnknown = iota
|
||||
|
||||
// ReachabilityPublic indicates that the node is reachable from the
|
||||
// public internet.
|
||||
ReachabilityPublic
|
||||
|
||||
// ReachabilityPrivate indicates that the node is not reachable from the
|
||||
// public internet.
|
||||
//
|
||||
// NOTE: This node may _still_ be reachable via relays.
|
||||
ReachabilityPrivate
|
||||
)
|
||||
|
||||
// Stat stores metadata pertaining to a given Stream/Conn.
|
||||
type Stat struct {
|
||||
Direction Direction
|
||||
|
Loading…
Reference in New Issue
Block a user