probe-lab / go-kademlia

Generic Go Kademlia implementation
Other
18 stars 4 forks source link

Generic kadkey #51

Closed iand closed 1 year ago

iand commented 1 year ago

When https://github.com/golang/go/issues/44253 is implemented we could replace any by [...]byte

guillaumemichel commented 1 year ago

In order to remove the errors returned from KadKey methods, we can simply accept any size of key, and move the responsibility to check the key size to the caller.

When an method is called on 2 keys of different size, consider that the shorter one is a prefix (aligned left). Just like if we pad right zeros to the shortest key.