Commit Graph

284 Commits

Author SHA1 Message Date
Steven Allen
a14197ce56
Merge pull request #145 from libp2p/fix/by-pointer
fix: envelop contains a mutex and can't be copied.
2020-04-24 18:36:42 -07:00
Steven Allen
744b95d7d8 fix: envelop contains a mutex and can't be copied. 2020-04-24 18:34:03 -07:00
Steven Allen
970fe32cba
Merge pull request #141 from libp2p/fix/reachability-type
fix: use correct reachability type
2020-04-13 11:02:00 -07:00
Steven Allen
4cb536b589 fix: use correct reachability type 2020-04-13 10:42:57 -07:00
Steven Allen
9d9170e9d8
Merge pull request #134 from edjx/feat/peer-records-pb-conv
PeerRecord: Add ToProtobuf() to get a PeerRecord's equivalent protobuf struct
2020-04-13 09:25:53 -07:00
Steven Allen
eb00c1a72e
Merge pull request #140 from libp2p/docs/routing
doc(routing): document count
2020-04-09 11:05:31 -07:00
Steven Allen
aa005892ff doc(routing): document count
Count == 0 now means that we search for an unbounded number of providers.
2020-04-09 10:59:58 -07:00
Steven Allen
2159f6a2ed
Merge pull request #137 from libp2p/fix/insecure-transport
fix: don't drop bytes in the insecure transport
2020-04-02 20:54:13 -07:00
Steven Allen
9df5e4fcaf fix: don't drop bytes in the insecure transport
gogo's varint reader buffers internally. If you use it then throw it away,
you'll drop data. This commit reverts to using msgio, but uses the varint
reader/writers instead.
2020-04-02 20:44:44 -07:00
Steven Allen
33981f5696
Merge pull request #133 from libp2p/dependabot/go_modules/github.com/jbenet/goprocess-0.1.4
build(deps): bump github.com/jbenet/goprocess from 0.1.3 to 0.1.4
2020-03-29 23:56:32 -07:00
Vibhav Pant
6690d78eeb
peer: Add PeerRecordFromProtobuf. 2020-03-27 11:24:40 +05:30
Aarsh Shah
dbfc912c81
Merge pull request #136 from libp2p/feat/signed-record-addr-change-evt
Put signed peer record in the Address Change Event
2020-03-27 00:06:39 +05:30
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
Vibhav Pant
075ac7484c
(*PeerRecord.MarshalRecord): Use ToProtobuf() to get protobuf struct 2020-03-25 17:42:49 +05:30
Vibhav Pant
4013be10ed
peer: Add (*PeerRecord).ToProtoBuf to get protobuf equivalent struct 2020-03-25 17:34:36 +05:30
dependabot-preview[bot]
4c983715a3
build(deps): bump github.com/jbenet/goprocess from 0.1.3 to 0.1.4
Bumps [github.com/jbenet/goprocess](https://github.com/jbenet/goprocess) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/jbenet/goprocess/releases)
- [Commits](https://github.com/jbenet/goprocess/compare/v0.1.3...v0.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-25 11:19:03 +00:00
Steven Allen
fdc64dde88
deps: move tools to a sub-module (#130)
That way, the root module doesn't depend on gocompat and all its dependencies.
2020-03-09 19:57:19 -07:00
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
Marten Seemann
ab2bf16021
remove the Protector interface, introduce a PSK type (#118)
* remove the Protector interface, introduce a PSK type
* move decoding of the v1 PSK here
2020-03-06 17:18:20 -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
Raúl Kripalani
df4636fec7
go mod tidy. (#128) 2020-03-06 09:52:02 +00:00
Vibhav Pant
d3e1a0646b
add functions for converting libp2p keys to stdlib variants (#125) 2020-03-06 09:46:59 +00:00
Steven Allen
d143201d83
Merge pull request #126 from libp2p/feat/single-routability-event
Switch to a single routability event
2020-03-04 21:15:24 -08:00
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
Steven Allen
2adfc2112a
Merge pull request #124 from vasco-santos/docs/uniform
docs: uniform comment sentences
2020-03-03 09:28:16 -08:00
Vasco Santos
43f10f2288 docs: uniform comment sentences 2020-03-03 18:16:38 +01:00
Aarsh Shah
3ff44e3770 docs change 2020-03-03 13:53:03 +05:30
Steven Allen
ee95739931
Merge pull request #122 from libp2p/dependabot/go_modules/github.com/multiformats/go-multiaddr-0.2.1
build(deps): bump github.com/multiformats/go-multiaddr from 0.2.0 to 0.2.1
2020-03-02 08:49:44 -08:00
dependabot-preview[bot]
a4abfae3ee
build(deps): bump github.com/multiformats/go-multiaddr
Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/multiformats/go-multiaddr/releases)
- [Commits](https://github.com/multiformats/go-multiaddr/compare/v0.2.0...v0.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 11:20:25 +00:00
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
Aarsh Shah
8ca20a2d61 enable network to emit events on a bus 2020-02-28 15:46:35 +05:30
Steven Allen
bcf3ad5c24
Merge pull request #116 from libp2p/fix/license-detection
chore(license): fix license detection
2020-02-19 10:53:04 -05:00
Steven Allen
6159b87ee7
Merge pull request #115 from libp2p/dependabot/go_modules/github.com/libp2p/go-buffer-pool-0.0.2
build(deps): bump github.com/libp2p/go-buffer-pool from 0.0.1 to 0.0.2
2020-02-11 10:38:08 -08:00
Steven Allen
59df5e58a2 chore(license): fix license detection
Adding URLs to the licenses will cause go to detect this project as Apache 2.0.

fix #114
2020-02-11 10:34:23 -08:00
dependabot-preview[bot]
d0e5396808
build(deps): bump github.com/libp2p/go-buffer-pool from 0.0.1 to 0.0.2
Bumps [github.com/libp2p/go-buffer-pool](https://github.com/libp2p/go-buffer-pool) from 0.0.1 to 0.0.2.
- [Release notes](https://github.com/libp2p/go-buffer-pool/releases)
- [Commits](https://github.com/libp2p/go-buffer-pool/compare/v0.0.1...v0.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-11 16:52:42 +00:00
Steven Allen
78c3b1fe4c
Merge pull request #110 from libp2p/dependabot/go_modules/github.com/ipfs/go-cid-0.0.5
build(deps): bump github.com/ipfs/go-cid from 0.0.4 to 0.0.5
2020-02-11 08:50:27 -08:00
Steven Allen
8ca6bfcb07
Merge pull request #108 from libp2p/dependabot/go_modules/go.opencensus.io-0.22.3
build(deps): bump go.opencensus.io from 0.22.2 to 0.22.3
2020-02-11 08:44:08 -08:00
Yusef Napora
3f5306c5d4
Use PeerRecord value instead of pointer in EvtLocalPeerRecordUpdated (#113) 2020-02-10 15:18:15 -05:00
dependabot-preview[bot]
f7961b9df5
build(deps): bump go.opencensus.io from 0.22.2 to 0.22.3
Bumps [go.opencensus.io](https://github.com/census-instrumentation/opencensus-go) from 0.22.2 to 0.22.3.
- [Release notes](https://github.com/census-instrumentation/opencensus-go/releases)
- [Commits](https://github.com/census-instrumentation/opencensus-go/compare/v0.22.2...v0.22.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-10 19:55:44 +00:00
dependabot-preview[bot]
c7f37b285b
build(deps): bump github.com/ipfs/go-cid from 0.0.4 to 0.0.5
Bumps [github.com/ipfs/go-cid](https://github.com/ipfs/go-cid) from 0.0.4 to 0.0.5.
- [Release notes](https://github.com/ipfs/go-cid/releases)
- [Commits](https://github.com/ipfs/go-cid/compare/v0.0.4...v0.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-10 19:55:37 +00: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
Steven Allen
e075dc9f00
Merge pull request #109 from libp2p/dependabot/go_modules/github.com/multiformats/go-multihash-0.0.13
build(deps): bump github.com/multiformats/go-multihash from 0.0.10 to 0.0.13
2020-02-04 10:29:02 -08:00
dependabot-preview[bot]
748a57a953
build(deps): bump github.com/multiformats/go-multihash
Bumps [github.com/multiformats/go-multihash](https://github.com/multiformats/go-multihash) from 0.0.10 to 0.0.13.
- [Release notes](https://github.com/multiformats/go-multihash/releases)
- [Commits](https://github.com/multiformats/go-multihash/compare/v0.0.10...v0.0.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-04 11:17:12 +00:00