Skip to content

Commit

Permalink
Merge pull request #126 from libp2p/feat/single-routability-event
Browse files Browse the repository at this point in the history
Switch to a single routability event
  • Loading branch information
Stebalien authored Mar 5, 2020
2 parents a9fc470 + b1eeefc commit 532eb83
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
13 changes: 13 additions & 0 deletions core/event/reachability.go
Original file line number Diff line number Diff line change
@@ -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
}
21 changes: 0 additions & 21 deletions core/event/routability.go

This file was deleted.

19 changes: 19 additions & 0 deletions core/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 532eb83

Please sign in to comment.