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
dms3
go-dms3
Commits
dd47364e
Commit
dd47364e
authored
May 27, 2020
by
Steven Allen
Committed by
Adin Schmahmann
Aug 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add protocol list to ipfs id
parent
dd1093f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
core/commands/id.go
core/commands/id.go
+8
-0
No files found.
core/commands/id.go
View file @
dd47364e
...
...
@@ -36,6 +36,7 @@ type IdOutput struct {
Addresses
[]
string
AgentVersion
string
ProtocolVersion
string
Protocols
[]
string
}
const
(
...
...
@@ -123,6 +124,7 @@ EXAMPLE:
output
=
strings
.
Replace
(
output
,
"<pver>"
,
out
.
ProtocolVersion
,
-
1
)
output
=
strings
.
Replace
(
output
,
"<pubkey>"
,
out
.
PublicKey
,
-
1
)
output
=
strings
.
Replace
(
output
,
"<addrs>"
,
strings
.
Join
(
out
.
Addresses
,
"
\n
"
),
-
1
)
output
=
strings
.
Replace
(
output
,
"<protocols>"
,
strings
.
Join
(
out
.
Protocols
,
"
\n
"
),
-
1
)
output
=
strings
.
Replace
(
output
,
"
\\
n"
,
"
\n
"
,
-
1
)
output
=
strings
.
Replace
(
output
,
"
\\
t"
,
"
\t
"
,
-
1
)
fmt
.
Fprint
(
w
,
output
)
...
...
@@ -166,6 +168,11 @@ func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) {
info
.
Addresses
=
append
(
info
.
Addresses
,
a
.
String
())
}
protocols
,
_
:=
ps
.
GetProtocols
(
p
)
// don't care about errors here.
for
_
,
p
:=
range
protocols
{
info
.
Protocols
=
append
(
info
.
Protocols
,
string
(
p
))
}
if
v
,
err
:=
ps
.
Get
(
p
,
"ProtocolVersion"
);
err
==
nil
{
if
vs
,
ok
:=
v
.
(
string
);
ok
{
info
.
ProtocolVersion
=
vs
...
...
@@ -200,6 +207,7 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
for
_
,
a
:=
range
addrs
{
info
.
Addresses
=
append
(
info
.
Addresses
,
a
.
String
())
}
info
.
Protocols
=
node
.
PeerHost
.
Mux
()
.
Protocols
()
}
info
.
ProtocolVersion
=
identify
.
LibP2PVersion
info
.
AgentVersion
=
version
.
UserAgent
...
...
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