@@ -36,6 +36,7 @@ type IdOutput struct {
36
36
Addresses []string
37
37
AgentVersion string
38
38
ProtocolVersion string
39
+ Protocols []string
39
40
}
40
41
41
42
const (
@@ -123,6 +124,7 @@ EXAMPLE:
123
124
output = strings .Replace (output , "<pver>" , out .ProtocolVersion , - 1 )
124
125
output = strings .Replace (output , "<pubkey>" , out .PublicKey , - 1 )
125
126
output = strings .Replace (output , "<addrs>" , strings .Join (out .Addresses , "\n " ), - 1 )
127
+ output = strings .Replace (output , "<protocols>" , strings .Join (out .Protocols , "\n " ), - 1 )
126
128
output = strings .Replace (output , "\\ n" , "\n " , - 1 )
127
129
output = strings .Replace (output , "\\ t" , "\t " , - 1 )
128
130
fmt .Fprint (w , output )
@@ -166,6 +168,11 @@ func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) {
166
168
info .Addresses = append (info .Addresses , a .String ())
167
169
}
168
170
171
+ protocols , _ := ps .GetProtocols (p ) // don't care about errors here.
172
+ for _ , p := range protocols {
173
+ info .Protocols = append (info .Protocols , string (p ))
174
+ }
175
+
169
176
if v , err := ps .Get (p , "ProtocolVersion" ); err == nil {
170
177
if vs , ok := v .(string ); ok {
171
178
info .ProtocolVersion = vs
@@ -200,6 +207,7 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
200
207
for _ , a := range addrs {
201
208
info .Addresses = append (info .Addresses , a .String ())
202
209
}
210
+ info .Protocols = node .PeerHost .Mux ().Protocols ()
203
211
}
204
212
info .ProtocolVersion = identify .LibP2PVersion
205
213
info .AgentVersion = version .UserAgent
0 commit comments