Commit Graph

56 Commits

Author SHA1 Message Date
Marten Seemann
5eae6d6caf limit the number of protocols we store per peer 2021-10-22 18:01:08 +02:00
Steven Allen
59822c4eb1 test: make the "add" test less timing dependent 2021-07-20 17:17:41 -07:00
Steven Allen
4a4c4886f7 fix: assert that peer record is accepted in test
This test is flaking on windows when using the leveldb datastore.
Hopefully, this extra check will help us narrow it down.
2021-07-20 17:17:41 -07:00
Steven Allen
0b07f55731 test: make tests less timing dependent 2021-07-16 19:45:29 -07:00
Steven Allen
4808543c09 fix: address lints 2021-07-16 10:38:05 -07:00
Steven Allen
cce0adbd0a fix: delete addrs when "updating" them to zero
1. Fix expiration check to check "not before" instead of after.
Otherwise, something that is expiring "now" won't count as expired. The
datastore-backed peerstore already had the correct logic.
2. Short-circuit updating the TTL to 0 and just delete the records.

Note: this wasn't causing problems on Linux (likely due to monotonic
clocks?) but was causing go-libp2p tests to fail reliably on Windows.
2021-04-29 17:20:27 -07:00
Steven Allen
56ebb42d5f fix: always update address TTLs in a signed peer record
Previously, we'd only set the TTL if the addresses were new.
2020-06-05 18:36:56 -07:00
Aarsh Shah
dd0775df6d changes for the new interface 2020-05-11 13:07:08 +05:30
Aarsh Shah
7a58f873f4 peer supports any protocol 2020-05-08 12:10:14 +05:30
Steven Allen
785ee8c8fd fix: handle nil peer IDs
Feels like Java all over again.

fixes #87
2020-04-05 23:05:41 -07:00
Yusef Napora
59abcf549d
Certified addresses (#98) 2020-03-06 12:07:36 +00:00
Steven Allen
334bc6f886 chore(dep): update deps
* update go-libp2p-core and fix tests for new minimum key size. This slows down
the test but terribly.
* switch to go-multiaddr-fmt
* update the datastore
* update gogo/protobuf
2019-10-28 15:32:22 -07:00
Steven Allen
2fb6d7a48f fix multiple TTL bugs
The first fix independently extends the address expiration time and the address
TTL:

By example:

* We have an address with a TTL of 4s that will expire in 1s.
* We update it with a TTL of 3s.

Before this change:

* We end up with an address with a TTL of 3s that will expire in 3s.

After this change:

* We end up with an address with a TTL of 4s that will expire in 3s.

---

The second fix prevents the in-memory addressbook from announcing existing
addresses every time their TTLs get updated.

---

The third fix correctly updates TTLs for existing addresses in the on-disk
addressbook.

This fixes https://github.com/libp2p/go-libp2p-identify/issues/2
2019-07-24 17:04:37 -07:00
Raúl Kripalani
3d3a10dd54
protobook: support removing protocols. (#84) 2019-06-19 23:53:07 +01:00
Steven Allen
9a662b9911 test: add metadata test 2019-05-31 19:58:37 -07:00
Steven Allen
0b5b389640 dep: switch to core (#80)
* dep: switch to core

Specifically, remove go-libp2p-{crypto,peer} deps.

* catch a few more usages of deprecated packages.
2019-05-31 14:51:16 +01:00
Raúl Kripalani
fec786e9ef pstore ds: make gc lookahead window optional. 2019-02-06 09:35:10 +00:00
Raúl Kripalani
d88042c422 improve code readability. 2019-02-05 16:52:27 +00:00
Raúl Kripalani
0baddf577e Merge branch 'master' into feat/pstore-ds-gc 2019-02-05 16:15:11 +00:00
Raúl Kripalani
6959c64874 add unit test to verify AddAddr doesn't shorten TTL. 2019-01-23 13:13:11 +00:00
Steven Allen
f32bc1c26d disable inline-peer id test 2018-12-07 13:47:26 -08:00
Raúl Kripalani
3a85498ae8 add tests for new GC routines. 2018-11-28 00:13:13 +00:00
Adrian Lanzafame
c04ff2d27b
add keybook benchmarks
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-11-07 15:48:31 +10:00
Adrian Lanzafame
308d998d76
sort suite so benchmarks always run in the same order
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-11-07 15:48:31 +10:00
Steven Allen
6c58e9f9fa fix the inline key test
RandTestKeyPair uses RSA keys but we now forbid any RSA key under 512 bits.
2018-11-02 15:24:44 -07:00
Steven Allen
588ab36ce8 update to match new ExtractPublicKey API
This is a "more correct" API and we might as well fix this before it becomes
used all over the place. The new API returns ErrNoPublicKey when there is no
inlined key.

This *also* fixes a bug where the datastore-backed keystore would panic if
`ExtractPublicKey` returned `nil, nil`.
2018-10-16 11:31:32 +01:00
Raúl Kripalani
4b2c1212e7 add a test and fix broken logic. 2018-09-14 18:27:23 +01:00
Raúl Kripalani
7c5cf50d9b adjust ttl tests as badger doesn't support sub-second ttl. 2018-09-13 16:09:32 +01:00
Raúl Kripalani
622589ab31 attempt to fix time-dependent tests in CI. 2018-09-13 10:35:03 +01:00
Raúl Kripalani
95cce50f15 hopefully fix intermittent time-dependent test failure. 2018-09-12 13:53:10 +01:00
Raúl Kripalani
4037390c42 increase test coverage. 2018-09-11 18:17:27 +01:00
Raúl Kripalani
7ae2621803 small fixes. 2018-09-11 14:42:19 +01:00
Raúl Kripalani
1b410c7294 Merge branch 'master' into txndatastore 2018-09-11 14:13:14 +01:00
Raúl Kripalani
903aa12603 check cache in ClearAddrs and perform targeted delete. 2018-09-11 12:43:36 +01:00
Raúl Kripalani
1c25f160a1 normalise import aliases. 2018-09-07 18:46:23 +01:00
Raúl Kripalani
08de02b668 regroup test utils; remove unused function. 2018-09-07 18:45:58 +01:00
Raúl Kripalani
2901497643 migrate Addrs() and PeersWithAddrs() to use txns, improve perf, benchmarks. 2018-09-07 18:37:01 +01:00
Raúl Kripalani
027d289a66 nested test cases in addr_book suite. 2018-09-07 16:54:00 +01:00
Raúl Kripalani
9be48ff689 optimise benchmark code. 2018-09-07 13:04:14 +01:00
Raúl Kripalani
171f051aa1 add tests for keybook; []peer.ID => peer.IDSlice. 2018-09-07 13:04:14 +01:00
Raúl Kripalani
a3c72582f5 increase wait times in tests. 2018-09-06 20:18:25 +01:00
Raúl Kripalani
bc77b649dc rename AddrMgr => AddrBook elsewhere. 2018-09-05 15:10:18 +01:00
Raúl Kripalani
fe732515cd add benchmark for ClearAddrs. 2018-09-04 18:02:00 +01:00
Raúl Kripalani
9b5c1de960 move benchmarks test cases to benchmarks_suite.go. 2018-09-04 16:21:02 +01:00
Raúl Kripalani
1b57c62e3d increase benchmark coverage; introduce config struct.
* benchmark caching and cacheless variants of DS addrbook.
* benchmark peers with 1, 10, 100 addrs.
2018-09-07 17:45:29 +01:00
Raúl Kripalani
ad75ca465e regroup test and benchmark utils. 2018-09-07 17:45:29 +01:00
Raúl Kripalani
e200f3a5c1 gx-go unrewrite. 2018-09-02 12:10:55 +01:00
Raúl Kripalani
580527bc73 fix nil dereference in benchmarks. 2018-08-31 13:30:13 +01:00
Raúl Kripalani
5865418f5c organise imports. 2018-08-30 16:24:09 +01:00
Raúl Kripalani
b9ac6b77b1 gx-go rw. 2018-08-30 15:26:03 +01:00