Update
This commit is contained in:
1 parent
3530afb854
commit
6903fcff27
2146 files changed
+112256
-190703
No files matched your search
+39
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package peernode
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Reachability reports whether a peer node is reachable.
|
||||
type Reachability int
|
||||
|
||||
const (
|
||||
// Unknown is a peer node whose reachability is unknown.
|
||||
// This peer is new and we have yet to probe it.
|
||||
Unknown Reachability = iota
|
||||
// Reachable is a peer node that is reachable from this node.
|
||||
Reachable
|
||||
// Unreachable is a peer node that is unreachable from this node.
|
||||
// This peer is not responding to probes.
|
||||
Unreachable
|
||||
)
|
||||
|
||||
// String implements [fmt.Stringer].
|
||||
func (r Reachability) String() string {
|
||||
switch r {
|
||||
case Unknown:
|
||||
return "Unknown"
|
||||
case Reachable:
|
||||
return "Reachable"
|
||||
case Unreachable:
|
||||
return "Unreachable"
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown %#v", r))
|
||||
}
|
||||
}
|
||||
|
||||
// IsReachable reports if r is [Reachable].
|
||||
func (r Reachability) IsReachable() bool {
|
||||
return r == Reachable
|
||||
}
|
||||
Reference in new issue
Block a user