Skip to content

Commit 4bef3ce

Browse files
committed
p2p: print Cap as name/version
1 parent 49a739c commit 4bef3ce

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎p2p/protocol.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package p2p
22

3+
import "fmt"
4+
35
// Protocol represents a P2P subprotocol implementation.
46
type Protocol struct {
57
// Name should contain the official protocol name,
@@ -37,6 +39,10 @@ func (cap Cap) RlpData() interface{} {
3739
return []interface{}{cap.Name, cap.Version}
3840
}
3941

42+
func (cap Cap) String() string {
43+
return fmt.Sprintf("%s/%d", cap.Name, cap.Version)
44+
}
45+
4046
type capsByName []Cap
4147

4248
func (cs capsByName) Len() int { return len(cs) }

0 commit comments

Comments
 (0)