package p2p import "fmt" var OurCaps = []Cap{ {Name: "diff", Version: 1}, {Name: "snap", Version: 1}, {Name: "eth", Version: 65}, {Name: "eth", Version: 66}, {Name: "eth", Version: 67}, } // Cap is the structure of a peer capability. type Cap struct { Name string Version uint } func (cap Cap) String() string { return fmt.Sprintf("%s/%d", cap.Name, cap.Version) } type capsByNameAndVersion []Cap func (cs capsByNameAndVersion) Len() int { return len(cs) } func (cs capsByNameAndVersion) Swap(i, j int) { cs[i], cs[j] = cs[j], cs[i] } func (cs capsByNameAndVersion) Less(i, j int) bool { return cs[i].Name < cs[j].Name || (cs[i].Name == cs[j].Name && cs[i].Version < cs[j].Version) }