remove ConnectionID.Equal function

Connection IDs can now be compared with ==.
This commit is contained in:
Marten Seemann
2022-08-28 16:11:28 +03:00
parent 1aced95d41
commit 4cbb4f8114
9 changed files with 17 additions and 34 deletions

View File

@@ -86,11 +86,6 @@ func ReadConnectionID(r io.Reader, l int) (ConnectionID, error) {
return c, err
}
// Equal says if two connection IDs are equal
func (c ConnectionID) Equal(other ConnectionID) bool {
return c == other
}
// Len returns the length of the connection ID in bytes
func (c ConnectionID) Len() int {
return int(c.l)

View File

@@ -43,18 +43,6 @@ var _ = Describe("Connection ID generation", func() {
Expect(has20ByteConnID).To(BeTrue())
})
It("says if connection IDs are equal", func() {
c1 := ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8})
c2 := ParseConnectionID([]byte{8, 7, 6, 5, 4, 3, 2, 1})
c3 := ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8})
Expect(c1.Equal(c1)).To(BeTrue())
Expect(c1.Equal(c3)).To(BeTrue())
Expect(c2.Equal(c2)).To(BeTrue())
Expect(c2.Equal(c3)).To(BeFalse())
Expect(c1.Equal(c2)).To(BeFalse())
Expect(c2.Equal(c1)).To(BeFalse())
})
It("reads the connection ID", func() {
buf := bytes.NewBuffer([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9})
c, err := ReadConnectionID(buf, 9)