Commit Graph

154 Commits

Author SHA1 Message Date
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
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
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
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
Steven Allen
0ad6b1c741
Merge pull request #52 from mhchia/patch-1
fix: get `remoteID` from pb message in plaintext
2020-01-11 09:17:07 +01:00
Steven Allen
4c2606ef48
Merge pull request #103 from Mikerah/master
Update README.md
2019-12-20 16:15:28 +01:00
Mikerah
f86f7e0ef7
Update README.md 2019-12-19 09:57:16 -05:00
Steven Allen
2ee848f4f1
Merge pull request #102 from libp2p/dependabot/go_modules/github.com/ipfs/go-cid-0.0.4
build(deps): bump github.com/ipfs/go-cid from 0.0.3 to 0.0.4
2019-12-17 12:44:27 +01:00
dependabot-preview[bot]
94fac75dea
build(deps): bump github.com/ipfs/go-cid from 0.0.3 to 0.0.4
Bumps [github.com/ipfs/go-cid](https://github.com/ipfs/go-cid) from 0.0.3 to 0.0.4.
- [Release notes](https://github.com/ipfs/go-cid/releases)
- [Commits](https://github.com/ipfs/go-cid/compare/v0.0.3...v0.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-16 11:20:22 +00:00
Steven Allen
6f2516674a
Merge pull request #100 from Mikerah/patch-1
typo fix
2019-12-14 09:08:25 +01:00
Mikerah
e5d371f86c
typo fix 2019-12-13 15:24:15 -05:00
Steven Allen
f7f724862d
Merge pull request #98 from libp2p/dependabot/go_modules/github.com/multiformats/go-multiaddr-0.2.0
build(deps): bump github.com/multiformats/go-multiaddr from 0.1.2 to 0.2.0
2019-12-11 14:59:31 +01:00
dependabot-preview[bot]
ee9d9da3cf
build(deps): bump github.com/multiformats/go-multiaddr
Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.1.2 to 0.2.0.
- [Release notes](https://github.com/multiformats/go-multiaddr/releases)
- [Commits](https://github.com/multiformats/go-multiaddr/compare/v0.1.2...v0.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-11 11:34:55 +00:00
Marcin Rataj
ba9101b589
feat: support encoding/decoding peer IDs as CIDs in text (#41)
What:

1. Supports decoding CIDs (of libp2p keys) as peer IDs 
   (https://github.com/libp2p/specs/issues/216)
2. Continues to encode peer IDs as base58 multihashes by default.
3. Adds functions for converting between peer IDs and CIDs.
4. Deprecates IDB58{Decode,Encode}, replacing them with {Decode,Encode}.

Why:

1. We _need_ to support multibase somehow, so we can put peer IDs in domains.
2. This makes peer IDs fully self describing. That is, the CID itself indicates that it's a hash of a libp2p public key.
3. It's much easier to upgrade wire protocols than text. This change punts
pids-as-cids on the wire down the road but that's something we can revisit if it ever becomes relevant. 

See https://github.com/libp2p/specs/issues/111 for context.

Deviations from that issue:

* This _retains_ the current peer ID inlining of ed25519 keys. That turned out to be a nightmare, one I'd like to punt a bit more down the road.
* Likewise, this _punts_ the question of embedding the multi-hash algorithm in the public key.
2019-12-10 17:51:54 +01:00
Marcin Rataj
4184c18976
Merge branch 'master' into feat/parse-cid-as-pid
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2019-12-10 13:33:41 +01:00
Steven Allen
edd5242a11
Merge pull request #95 from libp2p/chore/update-rest
chore(dep): update btc (sekp) and openssl libraries
2019-12-09 06:35:17 -06:00
Steven Allen
af4f53a061 chore(dep): update btc (sekp) and openssl libraries
* The btc (sekp crypto) library now uses go mod.
* Our openssl library now supports a few more platforms.
2019-12-09 13:19:02 +01:00
Steven Allen
c4d6359d16
Merge pull request #96 from libp2p/dependabot/go_modules/github.com/libp2p/go-openssl-0.0.4
build(deps): bump github.com/libp2p/go-openssl from 0.0.3 to 0.0.4
2019-12-09 05:53:59 -06:00
dependabot-preview[bot]
a986079787
build(deps): bump github.com/libp2p/go-openssl from 0.0.3 to 0.0.4
Bumps [github.com/libp2p/go-openssl](https://github.com/libp2p/go-openssl) from 0.0.3 to 0.0.4.
- [Release notes](https://github.com/libp2p/go-openssl/releases)
- [Commits](https://github.com/libp2p/go-openssl/compare/v0.0.3...v0.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-09 11:20:31 +00:00
Steven Allen
f93c24de5d
Merge pull request #94 from libp2p/feat/std-ed25519
use standard library "crypto/ed25519"
2019-12-07 10:50:16 -05:00
Steven Allen
d25b4807f3 docs(readme): specify minimum go version 2019-12-07 10:33:12 -05:00
Steven Allen
cd602e126d chore: bump minimum go version 2019-12-07 10:32:20 -05:00
Steven Allen
0a54f30725
Merge pull request #88 from libp2p/fix/document-query-notifications
docs(routing/query): document public query event interfaces
2019-12-07 10:25:48 -05:00
Dmitry Yu Okunev
205fb711b9 Use standard library "crypto/ed25519" 2019-12-06 21:58:31 -05:00
Steven Allen
54a9d30499
Merge pull request #56 from JorikSchellekens/patch-1
Fix documentation missmatch for crypto methods.
2019-12-06 21:50:47 -05:00
Steven Allen
2ab3ece606
Merge pull request #83 from libp2p/dependabot/go_modules/github.com/mr-tron/base58-1.1.3
build(deps): bump github.com/mr-tron/base58 from 1.1.2 to 1.1.3
2019-12-06 19:55:27 -05:00
dependabot-preview[bot]
d9020dbcf6
build(deps): bump github.com/mr-tron/base58 from 1.1.2 to 1.1.3
Bumps [github.com/mr-tron/base58](https://github.com/mr-tron/base58) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/mr-tron/base58/releases)
- [Commits](https://github.com/mr-tron/base58/compare/v1.1.2...v1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 00:44:47 +00:00
Steven Allen
c8a9de1043
Merge pull request #82 from libp2p/dependabot/go_modules/github.com/multiformats/go-multiaddr-0.1.2
build(deps): bump github.com/multiformats/go-multiaddr from 0.1.1 to 0.1.2
2019-12-06 19:42:42 -05:00
dependabot-preview[bot]
ebca051e1f
build(deps): bump github.com/multiformats/go-multiaddr
Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.1.1 to 0.1.2.
- [Release notes](https://github.com/multiformats/go-multiaddr/releases)
- [Commits](https://github.com/multiformats/go-multiaddr/compare/v0.1.1...v0.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-06 22:30:49 +00:00
Steven Allen
5383f357cc
Merge pull request #84 from libp2p/dependabot/go_modules/go.opencensus.io-0.22.2
build(deps): bump go.opencensus.io from 0.22.1 to 0.22.2
2019-12-06 17:28:34 -05:00
dependabot-preview[bot]
8f5557aa4d
build(deps): bump go.opencensus.io from 0.22.1 to 0.22.2
Bumps [go.opencensus.io](https://github.com/census-instrumentation/opencensus-go) from 0.22.1 to 0.22.2.
- [Release notes](https://github.com/census-instrumentation/opencensus-go/releases)
- [Commits](https://github.com/census-instrumentation/opencensus-go/compare/v0.22.1...v0.22.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-06 22:09:11 +00:00
Steven Allen
9607f2d14a
Merge pull request #85 from libp2p/dependabot/go_modules/github.com/multiformats/go-multihash-0.0.10
build(deps): bump github.com/multiformats/go-multihash from 0.0.8 to 0.0.10
2019-12-06 17:06:56 -05:00
Steven Allen
e8536bbb2a Merge branch 'ci/go-1.13' 2019-12-06 16:47:08 -05:00