Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit d143201

Browse files
authored
Merge pull request #126 from libp2p/feat/single-routability-event
Switch to a single routability event
2 parents 2adfc21 + e5f43bb commit d143201

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

event/reachability.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package event
2+
3+
import (
4+
"github.com/libp2p/go-libp2p-core/network"
5+
)
6+
7+
// EvtLocalReachabilityChanged is an event struct to be emitted when the local's
8+
// node reachability changes state.
9+
//
10+
// This event is usually emitted by the AutoNAT subsystem.
11+
type EvtLocalReachabilityChanged struct {
12+
Reachability network.Reachability
13+
}

event/routability.go

-21
This file was deleted.

network/network.go

+19
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@ const (
5353
CannotConnect
5454
)
5555

56+
// Reachability indicates how reachable a node is.
57+
type Reachability int
58+
59+
const (
60+
// ReachabilityUnknown indicates that the reachability status of the
61+
// node is unknown.
62+
ReachabilityUnknown = iota
63+
64+
// ReachabilityPublic indicates that the node is reachable from the
65+
// public internet.
66+
ReachabilityPublic
67+
68+
// ReachabilityPrivate indicates that the node is not reachable from the
69+
// public internet.
70+
//
71+
// NOTE: This node may _still_ be reachable via relays.
72+
ReachabilityPrivate
73+
)
74+
5675
// Stat stores metadata pertaining to a given Stream/Conn.
5776
type Stat struct {
5877
Direction Direction

0 commit comments

Comments
 (0)