Yusef Napora
ae3bc7bdfb
cleanup DefaultRecord code a bit
...
- removes unused error return from blankRecordForPayloadType
- just references instead of copying in DefaultRecord.UnmarshalRecord
I figure this is likely safe, since we'll be unmarshalling from the
payload of an Envelope, which shouldn't get altered after it's
created.
2020-01-17 16:52:59 -05:00
Yusef Napora
a26c845a76
use a DefaultRecord for unregistered PayloadTypes
...
instead of returning an error if we don't have a registered
Record for a given PayloadType, we can have a catch-all
DefaultRecord type that just preserves the original payload
as a []byte
2020-01-17 16:43:55 -05:00
Yusef Napora
3c208b0d26
Revert "return buffer to pool before early return"
...
8d8da386f2
misread this - unsigned will be nil if there's an
error, so it was right the way it was
2020-01-17 15:43:33 -05:00
Yusef Napora
7ee4611788
store reflect.Type when registering Record
2020-01-17 10:48:37 -05:00
Yusef Napora
972454490a
doc comments
2020-01-17 10:42:26 -05:00
Yusef Napora
cf0122ad8c
cache unmarshalled Record payload inside Envelope
2020-01-17 10:42:26 -05:00
Yusef Napora
d567b24477
rename CertifiedAddrBook methods, update comments
2020-01-17 10:42:26 -05:00
Yusef Napora
39d8cbc758
doc comments
2020-01-17 10:42:26 -05:00
Yusef Napora
8d8da386f2
return buffer to pool before early return
2020-01-17 10:42:26 -05:00
Yusef Napora
77a03aaf83
rename SignedEnvelope -> Envelope, unmarshal payload in ConsumeEnvelope
2020-01-17 10:42:26 -05:00
Yusef Napora
8dc249ddde
use Record type for envelope payloads
2020-01-17 10:42:26 -05:00
Yusef Napora
1ff557877c
comments for PeerRecord proto message
...
also removes the seq field from PeerMessage proto,
since it was moved to the SignedEnvelope
2020-01-17 10:42:26 -05:00
Yusef Napora
4b29ab4bbf
fix import ordering
2020-01-17 10:42:26 -05:00
Yusef Napora
be3fa5fd3f
fix proto_path in Makefile
2020-01-17 10:42:26 -05:00
Yusef Napora
ce6885c21e
add Seq field to envelope signature
2020-01-17 10:42:26 -05:00
Yusef Napora
25c1a5dcd2
commit go.sum
2020-01-17 10:42:26 -05:00
Yusef Napora
5f6b601ac9
hoist Seq from PeerRecord to SignedEnvelope
2020-01-17 10:42:26 -05:00
Yusef Napora
59348dea5a
test that PeerRecords can't be signed by wrong key
2020-01-17 10:42:26 -05:00
Yusef Napora
2e8cabcc87
rename RoutingStateRecord -> PeerRecord
...
also removes embedded reference to Envelope from the record,
as that was confusing.
as a result, the CertifiedAddrBook now accepts/returns
record.SignedEnvelope instead of a specialized type.
2020-01-17 10:42:26 -05:00
Yusef Napora
ae465aa5b8
define CertifiedAddrBook to avoid breaking API change
2020-01-17 10:42:26 -05:00
Raúl Kripalani
bb547efe8c
move protobuf files; adjust imports everywhere.
2020-01-17 10:42:26 -05:00
Raúl Kripalani
123324dc1b
move envelope to record package.
2020-01-17 10:42:26 -05:00
Raúl Kripalani
6028ba0bba
envelope: use byte slices from pool; adjust interface.
2020-01-17 10:42:26 -05:00
Yusef Napora
0bcca67988
remove SignedRoutingStateFromHost helper
...
moving this to go-libp2p
2020-01-17 10:42:26 -05:00
Yusef Napora
8a8390e4f7
add events for updated addresses and routing state
2020-01-17 10:42:26 -05:00
Yusef Napora
74bb6bbf1e
filter private addrs from signed routing records
2020-01-17 10:42:26 -05:00
Yusef Napora
1168b4d715
rm stray ref to golang/protobuf
2020-01-17 10:42:26 -05:00
Yusef Napora
ae469c6801
remove payloadType check when unmarhaling
2020-01-17 10:42:26 -05:00
Yusef Napora
305fff1b3c
fix: rebuild protos with new gogofaster generator
2020-01-17 10:42:26 -05:00
Yusef Napora
fb521c6433
use camelCase in protos for consistency
2020-01-17 10:42:26 -05:00
Yusef Napora
ff5ddb3846
use multiformats uvarint for length-prefixes
2020-01-17 10:42:26 -05:00
Yusef Napora
272731be60
expose struct fields & remove accessors
2020-01-17 10:42:26 -05:00
Yusef Napora
347316f262
whitespace
2020-01-17 10:42:26 -05:00
Yusef Napora
00306a4903
rm batching SignedRoutingStates accessor in peerstore
...
the datastore peerstore implementation doesn't support batched reads, so
it's no more efficient to get a bunch of states at once than it
is to call SignedRoutingState multiple times.
2020-01-17 10:42:26 -05:00
Yusef Napora
bf3693255b
get rid of unsigned RoutingState struct, only expose SignedRoutingState
2020-01-17 10:42:26 -05:00
Yusef Napora
a56dc2cb55
use test helpers
2020-01-17 10:42:26 -05:00
Yusef Napora
cf19665533
rename Equals -> Equal, add some comments
2020-01-17 10:42:26 -05:00
Yusef Napora
c8a9a5eafe
go fmt
2020-01-17 10:42:26 -05:00
Yusef Napora
7d10658fce
tests for RoutingState
2020-01-17 10:42:26 -05:00
Yusef Napora
be36d83110
use buffer pool for envelope signatures
2020-01-17 10:42:26 -05:00
Yusef Napora
3724a31efe
make envelope fields private & validate on unmarshal
2020-01-17 10:42:26 -05:00
Yusef Napora
a8a530e24f
use proto3 for routing records
2020-01-17 10:42:26 -05:00
Yusef Napora
cf0cfa5750
use proto3 & rename fields to match spec changes
2020-01-17 10:42:26 -05:00
Yusef Napora
f583d3c4ce
just use nanoseconds
2020-01-17 10:42:26 -05:00
Yusef Napora
d75c257932
update to match spec changes
2020-01-17 10:42:26 -05:00
Yusef Napora
f01458e2e6
add method to peerstore to retrieve signed routing records
2020-01-17 10:42:26 -05:00
Yusef Napora
c016eb5a80
go fmt
2020-01-17 10:42:26 -05:00
Yusef Napora
2ebfd9d4f2
fix doc comment
2020-01-17 10:42:26 -05:00
Yusef Napora
791e33fcce
add helpers to make routing records for Host
2020-01-17 10:42:26 -05:00
Yusef Napora
8d61036c08
add routing state records, extend peerstore API
2020-01-17 10:42:26 -05:00