Commit Graph

23 Commits

Author SHA1 Message Date
Aarsh Shah
412dbb3544
Event for user's NAT Device Type: Tell user if the node is behind an Easy or Hard NAT (#173)
* event for NAT device type


Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2021-02-18 14:17:27 +05:30
Raúl Kripalani
264788628f
eventbus: add wildcard subscription type; getter to enumerate known types (#153) 2020-05-20 18:52:50 +01:00
Raúl Kripalani
30bf48c8d6
events: add a generic DHT event. (#154) 2020-05-20 13:12:54 +01:00
Steven Allen
744b95d7d8 fix: envelop contains a mutex and can't be copied. 2020-04-24 18:34:03 -07:00
Aarsh Shah
daf715e657
Update event/addrs.go
Co-Authored-By: Raúl Kripalani <raul@protocol.ai>
2020-03-27 00:05:03 +05:30
Aarsh Shah
fd1a4d28c6
Update event/addrs.go
Co-Authored-By: Raúl Kripalani <raul@protocol.ai>
2020-03-27 00:04:57 +05:30
Aarsh Shah
8173af76d1 put signed peer record in address change event 2020-03-26 17:27:09 +05:30
Steven Allen
371a34d801
doc(event): document network events (#129)
Add extensive documentation to network events to explain the edge-cases.

Co-authored-by: Will <will@cypherpunk.email>
2020-03-06 17:18:54 -08:00
Aarsh Shah
c2bf839f74
Merge pull request #120 from libp2p/feat/801
Introduce EvtPeerConnectednessChanged event
2020-03-06 16:14:55 +05:30
Aarsh Shah
493f2b140f changes as per raul's review 2020-03-06 16:08:03 +05:30
Aarsh Shah
22092abdbb changes as per review 2020-03-06 15:58:32 +05:30
Steven Allen
e5f43bb541 rename routability -> reachability 2020-03-04 12:43:11 -08:00
Steven Allen
8157087fc9 feat: switch to a single routability event
This means we can make the event _stateful_ so subscribing always gives us the
last state.
2020-03-04 11:35:48 -08:00
Aarsh Shah
3ff44e3770 docs change 2020-03-03 13:53:03 +05:30
Aarsh Shah
8721a124d2 peer connectedness event 2020-02-29 11:46:17 +05:30
Aarsh Shah
f4b25da8e4 remove network from the events 2020-02-28 16:18:42 +05:30
Aarsh Shah
3e988ff158 changes as per review 2020-02-28 16:06:03 +05:30
Yusef Napora
3f5306c5d4
Use PeerRecord value instead of pointer in EvtLocalPeerRecordUpdated (#113) 2020-02-10 15:18:15 -05:00
Yusef Napora
7b2888dfdb
Signed envelopes & routing records (#73)
* add SignedEnvelope type

* use struct for SignedEnvelope instead of exposing protobuf directly

* doc comments for envelopes

* tests for SignedEnvelopes

* add helpers to make routing records for Host

* fix doc comment

* go fmt

* add method to peerstore to retrieve signed routing records

* update to match spec changes

* just use nanoseconds

* use proto3  &  rename fields to match spec changes

* use proto3 for routing records

* make envelope fields private & validate on unmarshal

* use buffer pool for envelope signatures

* tests for RoutingState

* go fmt

* rename Equals -> Equal, add some comments

* use test helpers

* get rid of unsigned RoutingState struct, only expose SignedRoutingState

* 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.

* whitespace

* expose struct fields & remove accessors

* use camelCase in protos for consistency

* use multiformats uvarint for length-prefixes

* remove payloadType check when unmarhaling

* rm stray ref to golang/protobuf

* define CertifiedAddrBook to avoid breaking API change

* add events for updated addresses and routing state

* remove SignedRoutingStateFromHost helper

moving this to go-libp2p

* add routing state records, extend peerstore API

* fix: rebuild protos with new gogofaster generator

* filter private addrs from signed routing records

* envelope: use byte slices from pool; adjust interface.

* move envelope to record package.

* move protobuf files; adjust imports everywhere.

* 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.

* hoist Seq from PeerRecord to SignedEnvelope

* test that PeerRecords can't be signed by wrong key

* commit go.sum

* add Seq field to envelope signature

* fix proto_path in Makefile

* fix import ordering

* comments for PeerRecord proto message

also removes the seq field from PeerMessage proto,
since it was moved to the SignedEnvelope

* use Record type for envelope payloads

* rename SignedEnvelope -> Envelope, unmarshal payload in ConsumeEnvelope

* return buffer to pool before early return

* doc comments

* rename CertifiedAddrBook methods, update comments

* cache unmarshalled Record payload inside Envelope

* doc comments

* store reflect.Type when registering Record

* 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

* 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

* 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.

* use explicit payloadType in MakeEnvelopeWithRecord

* Revert DefaultRecord commits

ae3bc7bdfb
a26c845a76

* doc comments

* move Seq field back to PeerRecord

* make diffs optional in EvtLocalAddressesUpdated

* more envelope tests

* replace MakeEnvelope with record.Seal

also:
- add Domain and Codec fields to Record interface

* fix import

* add interface check

* rename ProcessPeerRecord -> ConsumePeerRecord

also, adds bool `accepted` return value

* rename event field, add doc comment

* peer record protobuf: fix field casing.

* record protobuf: add docs and fix casing.

* cleanup: group imports.

* nit: split test/utils.go => test/{addrs,errors}.go.

Co-authored-by: Raúl Kripalani <raul.kripalani@gmail.com>
2020-02-10 14:53:24 -05:00
Raúl Kripalani
52a4260be5 Introduce routability and protocol events; cache unmarshalled RSA keys (#105)
* event: Add autonat events (#25)

* add events for identify (#26)

* implement caching for rsaKey.Bytes()

* store marshalled protobuf in cache for RsaPublicKey.Bytes()

* fix(crypto): fix build when openssl is enabled

* add godocs to routability events.

Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
Co-authored-by: Whyrusleeping <why@ipfs.io>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
Co-authored-by: Steven Allen <steven@stebalien.com>
2020-01-16 02:29:26 +01:00
Cole Brown
baf7d1a4e3 Return error in Emit 2019-08-06 12:55:08 -04:00
Łukasz Magiera
786c4f4e0f eventbus interface changes (#22) 2019-06-21 17:46:11 +01:00
Whyrusleeping
6cf790510f eventbus abstraction + initial events (#17) 2019-06-20 15:59:53 +01:00