|
|
@ -1,5 +1,7 @@ |
|
|
|
package p2p |
|
|
|
package p2p |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import "fmt" |
|
|
|
|
|
|
|
|
|
|
|
// Protocol represents a P2P subprotocol implementation.
|
|
|
|
// Protocol represents a P2P subprotocol implementation.
|
|
|
|
type Protocol struct { |
|
|
|
type Protocol struct { |
|
|
|
// Name should contain the official protocol name,
|
|
|
|
// Name should contain the official protocol name,
|
|
|
@ -37,6 +39,10 @@ func (cap Cap) RlpData() interface{} { |
|
|
|
return []interface{}{cap.Name, cap.Version} |
|
|
|
return []interface{}{cap.Name, cap.Version} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (cap Cap) String() string { |
|
|
|
|
|
|
|
return fmt.Sprintf("%s/%d", cap.Name, cap.Version) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type capsByName []Cap |
|
|
|
type capsByName []Cap |
|
|
|
|
|
|
|
|
|
|
|
func (cs capsByName) Len() int { return len(cs) } |
|
|
|
func (cs capsByName) Len() int { return len(cs) } |
|
|
|