Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-core
Commits
9d35da13
Unverified
Commit
9d35da13
authored
May 14, 2020
by
Raúl Kripalani
Committed by
GitHub
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement Stringer for network.{Direction,Connectedness,Reachability}. (#150)
parent
e3a456b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
network/network.go
network/network.go
+24
-0
No files found.
network/network.go
View file @
9d35da13
...
...
@@ -34,6 +34,14 @@ const (
DirOutbound
)
func
(
d
Direction
)
String
()
string
{
str
:=
[
...
]
string
{
"Unknown"
,
"Inbound"
,
"Outbound"
}
if
d
<
0
||
int
(
d
)
>=
len
(
str
)
{
return
"(unrecognized)"
}
return
str
[
d
]
}
// Connectedness signals the capacity for a connection with a given node.
// It is used to signal to services and other peers whether a node is reachable.
type
Connectedness
int
...
...
@@ -53,6 +61,14 @@ const (
CannotConnect
)
func
(
c
Connectedness
)
String
()
string
{
str
:=
[
...
]
string
{
"NotConnected"
,
"Connected"
,
"CanConnect"
,
"CannotConnect"
}
if
c
<
0
||
int
(
c
)
>=
len
(
str
)
{
return
"(unrecognized)"
}
return
str
[
c
]
}
// Reachability indicates how reachable a node is.
type
Reachability
int
...
...
@@ -72,6 +88,14 @@ const (
ReachabilityPrivate
)
func
(
r
Reachability
)
String
()
string
{
str
:=
[
...
]
string
{
"Unknown"
,
"Public"
,
"Private"
}
if
r
<
0
||
int
(
r
)
>=
len
(
str
)
{
return
"(unrecognized)"
}
return
str
[
r
]
}
// Stat stores metadata pertaining to a given Stream/Conn.
type
Stat
struct
{
Direction
Direction
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment