Commit Graph

456 Commits

Author SHA1 Message Date
Aarsh Shah 973933ad7d
Remove race between ID, Push & Delta (#907)
* Solve races between Identify, Push and Delta.
2020-05-13 10:50:37 +05:30
Raúl Kripalani d9d18512ca
fix a compilation error introduced in 077a818. (#919) 2020-05-12 17:24:58 +01:00
Yusef Napora 077a81814f
exchange signed routing records in identify (#747)
*  Exchange signed routing records in identify


Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
2020-04-30 11:06:31 +05:30
Steven Allen 84b923c7bf fix: address code review 2020-04-24 23:54:07 -07:00
Steven Allen 06d9fc7987 fix: keep observed addrs alive as long as their associated connections are alive
Otherwise, if we're not creating new connections, we'll eventually forget them.

Up until now, this wasn't _too_ much of an issue because our peers would still
remember our addresses. However, we now _tell_ our connected peers when our
addresses change. That means we'll tell our peers to forget where we are,
preventing anyone from finding us.
2020-04-24 22:55:16 -07:00
Steven Allen d3b7b3b907 test: fix a flaky test 2020-04-24 19:33:19 -07:00
Aarsh Shah 3d676b688c skip test local addr filtering 2020-04-24 19:05:23 -07:00
Steven Allen bd040ba050 fix: refactor logic for identifying connections
0. NEVER call `peerstore.SetProtocols(p)` (clear the protocol set). Given the
   new identify events, if someone looked in the peerstore at the wrong time, they
   could decide that the peer no longer speaks some protocol.
1. Reliably wait for identify before trying to open a stream. The old logic was
   _really_ racy.
2. Avoids potentially calling identify on the same connection multiple times.
3. Calls identify as early as possible. Previously, we'd invoke identify on
   inbound connections using an event that was only invoked _after_ all `Connected`
   event handlers completed. Now we invoke identify from a `Connected` handler.
2020-04-24 19:05:22 -07:00
Steven Allen 5fa6149ed2
Merge pull request #889 from libp2p/fix/noisy-log-line
fix: reduce log level of a noisy log line
2020-04-17 11:55:36 -07:00
Steven Allen e13a3fe3a3 fix: reduce log level of a noisy log line
This will trigger whenever we're, e.g., offline.
2020-04-17 11:31:17 -07:00
Edgar Aroutiounian 28f45ac904 [discovery] missing defer .Stop on ticker 2020-04-16 19:25:48 -07:00
Will Scott 81302e977a
remote mock addresses won't be unspecified. deprioritize those 2020-04-14 13:37:45 -07:00
Aarsh Shah 615f125342
Remove goprocess from Host (#865)
* remove goprocess from Host
2020-04-06 11:34:45 +05:30
Aarsh Shah e17a6f8bf2 remove lastaddrs as member variable 2020-03-25 00:52:25 +05:30
Aarsh Shah fa575b4d32 changes as per review 2020-03-25 00:35:26 +05:30
Aarsh Shah 82be3ee46f signal address change 2020-03-25 00:10:23 +05:30
Steven Allen c99a5bfa25 test(mock): close the mocknet when fuzzing 2020-03-23 14:27:41 -07:00
Steven Allen 29b355faaa fix(mock): close the mocknet's peerstore 2020-03-23 14:27:16 -07:00
Steven Allen 5403811df9 fix: make sure to close the mocknet's context when canceled 2020-03-23 14:27:04 -07:00
Steven Allen 223cd42251 fix(mock): wait till we add the connection to set it up
Otherwise, we can try to remove it before we add it and panic.
2020-03-23 14:26:16 -07:00
Steven Allen 22232e0d6d fix(mock): fire disconnect notifications async like we do in the swarm 2020-03-23 14:25:38 -07:00
Will Scott 3d4e8d8032
Merge branch 'master' of github.com:libp2p/go-libp2p into feat/autorelay 2020-03-20 16:45:56 -07:00
Aarsh Shah d49806efc9 emit address change evt 2020-03-20 10:04:13 +05:30
Will Scott 685ba00833
update to current autonat interface 2020-03-19 13:27:48 -07:00
Aarsh Shah ed4646f711 local addr updated event 2020-03-19 19:05:15 +05:30
Will Scott 8008b5d58f
update autorelay to remove dependence on autonat
instead, learns nat status through event bus
2020-03-16 16:11:23 -07:00
Will Scott 89c193e0ca
Merge branch 'master' into feat/autorelay 2020-03-10 11:53:55 -07:00
Steven Allen 5f75aa2068 feat(mock): reliable notifications
* Export StreamComplement/ConnComplement convenience functions.
* Make the TestNotifications test pass reliably, even when we have a bunch of
streams (identify, etc.).
* Make the mock net order disconnect events after connect events.
* Make closing one side of a connection actually close both sides.
* Make it possible to extract a mock stream's complement.
* Fire remote events at the same time as the local events.
2020-03-09 17:15:01 -07:00
Steven Allen 4ccf017104
Merge pull request #820 from libp2p/fix/remove-goroutine
fix: remove an unnecessary goroutine
2020-03-06 22:52:41 -08:00
Will Scott 0458b76abb
update to changed event structure 2020-03-05 09:12:57 -08:00
Steven Allen 6cdc404180 fix: remove an unnecessary goroutine
The stream handler runs in a goroutine anyways. We might as well block it.
2020-03-02 15:51:36 -08:00
Hlib 5e30cdeaac use of mux.ErrReset 2020-02-28 17:21:51 +02:00
Will Scott 85a83edf80
defer subscription closes 2020-02-27 10:10:42 -08:00
Will Scott f5386bdf79
autorelay triggers on NAT events
better use of the event bus between these two
2020-02-26 19:38:50 -08:00
Steven Allen 7ba322244e emit identify events and avoid advertising localhost
* fix(identify): announce localhost as long as one side of the connection is local (#742)
* identify: emit events on completion/failure. (#660)
* identify: Update addr advertise logic to exclude localhost addrs… (#657)

This is a rollup of the stabilize fixes.

Co-authored-by: bigs <cole@protocol.ai>
Co-authored-by: Raúl Kripalani <raul@protocol.ai>
2020-02-21 12:45:25 -05:00
Steven Allen 9ee9d94ea2
chore(ci): fix a flaky test (#787)
Timing tests never work well in CI.
2020-02-05 18:05:37 +00:00
Steven Allen 76944c4fc8
Merge pull request #705 from libp2p/feat/static-relays
options to configure static relays for autorelay
2020-01-17 05:22:16 -08:00
optman 3f43dfe646 enable non-public address port mapping announcement 2020-01-15 18:38:39 +08:00
Steven Allen 9073eaaf8f fix: demote stream deadline errors to debug logs
Otherwise, we spam an error every time we try to negotiate a protocol on a
closed stream (e.g., when the underlying connection closes on us).
2020-01-03 09:14:43 -08:00
Steven Allen e5d28696f5 feat(host): recursively resolve addresses
We currently only resolve /dnsaddr addresses once. This patch resolves up to 32
dnsaddr addresses per dial.

fixes https://github.com/libp2p/go-libp2p/issues/744
2019-12-16 15:53:51 +01:00
Hector Sanjuan 7e49c66219 Identify: Make activation threshold configurable
Also: fix the comments and try to explain how the activation/aliveness of
addresses happen (and write the correct defaults).
2019-11-05 12:18:55 +01:00
Steven Allen 94d7efc58e chore(dep): update libp2p-core and protobuf
* Enforces 2048 bit RSA keys when using OpenSSL
* Updates go-multiaddr-dns for /dns support.
* Update gogo/protobuf and regenerate all protobufs.
2019-10-28 16:41:54 -07:00
vyzo 9cd56c0bab use a global variable for default relays
and rename DefaultRelays option to DefaultStaticRelays.
2019-10-08 13:01:29 +03:00
Steven Allen 1938505f5a dep: update go-multiaddr
for https://github.com/multiformats/go-multiaddr/issues/108
2019-09-18 23:02:37 -07:00
Raúl Kripalani 9cf6af474b add godocs. 2019-08-28 11:50:26 +01:00
vyzo 235848850e options to configure known relays for autorelay 2019-08-16 13:02:03 +03:00
Steven Allen e337633824 set a default client-version using go modules
This should help us improve network stats on who's using libp2p.
2019-08-12 19:13:22 -07:00
Steven Allen d73a51776e new: allow overriding the user-agent with an option
Instead of using a global variable.

This also:

* Adds an option to the identify service to set the user agent.
* Removes the ability to pass an identify service to NewHost as any reasonable
  Identify service already needs to be constructed with an instance of the host.
2019-08-12 19:13:21 -07:00
Cole Brown c261182d50 Adjust test timings for Ed25519 2019-08-02 18:05:59 -04:00
Cole Brown a80fc34f3a Update deps, mocknet tests 2019-08-02 18:05:59 -04:00