There's really no reason to expire these after 10 minutes as opposed to
30. Given that our default DHT refresh interval is 10 minutes, setting
this to 30 reduces the chances that we'll "forget" peers.
Specifically, move them _here_ from the peerstore. That way
packages (like the DHT) that currently directly rely on the peerstore,
can just use go-libp2p-core.
Moved from f7f22569f7/peerstore.go (L79-L93)
With some small modifications.
* fix: make timestamps strictly increasing
On Linux, this is almost always the case. Windows, however, doesn't have
nanosecond accuracy.
We make the timestamp sequence numbers strictly increasing by returning
the last timestamp + 1 where necessary.
* apply code review
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* use a lock
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* disable Travis
* set Go version to 1.15 and run go mod tidy
* add .github/workflows/automerge.yml
* add .github/workflows/go-test.yml
* add .github/workflows/go-check.yml
* chore: tidy submodule
* chore: give vet something to vet
* test: disable timing dependent bandwidth test unless we're on linux
Co-authored-by: web3-bot <web3-bot@users.noreply.github.com>
Co-authored-by: Steven Allen <steven@stebalien.com>
* run go mod tidy
* omit receiver name if unused
* remove unused type testkey in tests
* fix duplicate import of go-multiaddr
* fix use of deprecated peer.IDB58{Encode,Decode}
* use bytes.Equal instead of bytes.Compare
* fix unnecessary assigments to blank identifier
* use time.Until instead of t.Sub(time.Now())
* fix use of deprecated go-multihash.ID
* add missing error check in envelope test
* fix error check in tests
* add a helper function to go directly from a string to an AddrInfo
* Update peer/addrinfo.go
Co-authored-by: Will <will.scott@protocol.ai>
Co-authored-by: Will <will.scott@protocol.ai>
* add CloseRead/CloseWrite on streams
This changes the behavior of `Close` to behave as one would expect: it closes
the stream. The new methods, CloseWrite/CloseRead allow for closing the stream in
a single direction.
Note: This _does not_ implement CancelWrite/CancelRead as our stream muxer
_protocols_ don't support that.
fixes#9
* remove stream util helpers
FullClose and AwaitEOF were introduced to work around the fact that calling
Close on a stream only closed the write half. All users must adapt their code
to the new interfaces, so this change is intentionally breaking.