Steven Allen
e3a983a355
fix: don't leak a goroutine if a peer connects and immediately disconnects
2020-05-19 13:37:52 -07:00
Yusef Napora
82c11bce2a
sleep longer in test
2020-05-19 16:15:28 -04:00
Yusef Napora
bd9e7b59ce
detect listen addr changes in BasicHost
2020-05-19 16:12:56 -04:00
Yusef Napora
3364dccbbf
make test fail to demonstrate issue
2020-05-19 14:38:25 -04:00
Yusef Napora
0d6e02e95b
add test to demo missing peer records after listen
2020-05-19 14:20:24 -04:00
Aarsh Shah
a7671efe6b
no signed peer records for mocknets ( #934 )
...
* Disable generation of Signed peer record for Mockenets.
2020-05-19 13:16:54 +05:30
Steven Allen
b42ba0faf3
various identify fixes and nits ( #922 )
...
* various identify fixes and nits
Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
2020-05-14 17:24:10 +05:30
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
vyzo
b3085753dc
autorelay: ensure candidate relays can hop
2019-08-02 21:14:01 +03:00
Steven Allen
2fbe88f546
Merge pull request #667 from libp2p/fix/listen-addrs-mdns
...
mdns: always use interface addresses
2019-07-22 15:42:39 -07:00
Christian Muehlhaeuser
c73d2b9c8e
Added missing error check in test ( #683 )
2019-07-22 13:46:45 +01:00
Christian Muehlhaeuser
169f2d4139
Avoid unnecessary conversions ( #685 )
...
No need to convert these types.
2019-07-22 13:46:15 +01:00
Christian Muehlhaeuser
038cff7946
Simplify increments ( #684 )
2019-07-22 13:45:37 +01:00
Raúl Kripalani
5df2167ca9
Removed ineffectual assignments ( #682 )
...
We don't use `cs` here, drop it.
2019-07-22 13:45:02 +01:00
Christian Muehlhaeuser
0603b30056
Make use of time.Until & time.Since ( #681 )
...
No need to manually subtract timestamps.
2019-07-22 13:44:47 +01:00
Christian Muehlhaeuser
40cb489097
Fixed typos ( #680 )
...
Just a few nit-picky typo fixes.
2019-07-22 13:44:24 +01:00
Christian Muehlhaeuser
a7ce9cc593
Removed ineffectual assignments
...
We don't use `cs` here, drop it.
2019-07-22 02:38:39 +02:00
Steven Allen
554a8e7bed
mdns: always use interface addresses
...
We don't want to use the transformed/munged host addresses for local
announcements. Ideally, we'd take a more scientific approach to this (i.e.,
"host, please give me addresses relative to X") but we can't do that yet.
2019-07-15 21:04:05 -07:00
Raúl Kripalani
1cec1b9191
remove superfluous goroutine; avoid t.Fatal from goroutines.
2019-07-10 18:29:46 +01:00
Raúl Kripalani
8e4bc2ee2c
fix #672 : wait until done; fix ponger response.
2019-07-10 15:54:09 +01:00
Raúl Kripalani
9797b07de4
TestStreamsStress: reduce node count, increase stream density.
2019-07-10 14:52:26 +01:00
Steven Allen
3755b9afd6
test: full-close streams in stream stress test
2019-07-04 13:18:27 -07:00
Steven Allen
4c28cc75df
test: fix test fallout from notify push
2019-07-04 13:11:48 -07:00
Steven Allen
3a41aa03ac
test: mark helpers
2019-07-04 12:56:20 -07:00
Steven Allen
97f639055e
test: ensure double-closing the host doesn't cause any issues
2019-07-04 12:47:33 -07:00
Steven Allen
428d7135a5
doc: ensure nobody tries to add teardown logic to the host close function again
2019-07-04 12:46:17 -07:00
Steven Allen
2f06021e0c
fix: use the goprocess for closing
...
fixes #668
2019-07-04 12:32:01 -07:00
Raúl Kripalani
e69d17141c
integrate the event bus, handle protocol update events, make identify emit deltas ( #659 )
2019-06-24 14:44:47 +01:00
Steven Allen
1449765980
basic_host: ensure we close correctly when the context is canceled
...
As long as we _accept_ a context, we need to obey it.
2019-06-13 11:14:44 -07:00
Raúl Kripalani
d87f89314c
Consolidate abstractions and core types into go-libp2p-core ( #601 )
2019-05-26 22:55:46 +01:00
Steven Allen
192e96f186
test: increase delay for backpressure
...
CI is really slow.
2019-05-21 20:18:09 -07:00
Steven Allen
97d03a46b4
test: add a small delay to deal with write coalescing
2019-05-21 17:08:35 -07:00
vyzo
3437213b5f
close connection manager
2019-05-21 14:03:28 +03:00
vyzo
70c4f155e7
advertise for relay services every 30min
2019-05-17 22:14:16 +03:00
vyzo
0a221500fd
update use of discovery.FindPeers for new interface
2019-05-17 22:05:57 +03:00
Steven Allen
95cc0beda9
Merge pull request #626 from libp2p/fix/ping
...
ping: return a stream of results
2019-05-08 14:01:01 -07:00
Steven Allen
1b9cf3e2cb
test: disable flaky autorelay test in CI
...
This keeps breaking travis.
2019-05-07 15:53:37 -07:00
Steven Allen
d0ab45164c
ping: simplify ping loop
2019-05-07 15:47:55 -07:00
Steven Allen
d3d5351d81
ping: return a stream of results
...
Otherwise, we can't return errors. This is a breaking change but unlikely to
have a large impact on anyone but go-ipfs.
Part of https://github.com/ipfs/go-ipfs/issues/6298
2019-05-07 15:47:52 -07:00
vyzo
b8616c65b3
use cancelable background context in identify
2019-05-07 21:33:19 +03:00
vyzo
ba00011d34
avoid intermediate allocation in relayAddrs
...
now that we have the lock for the duration of the method, we don't need the intermediate
relays array. This removes it, and also extends the pre-allocation of the result array
by 2 so that it can cover two localhost and two private address bindings.
2019-04-22 20:26:02 +03:00
vyzo
97f1e71e86
cache relayAddrs for a short period of time
2019-04-22 19:48:01 +03:00
vyzo
abfb4c8901
fix bug in findRelaysOnce: it connects to all relays
2019-04-21 11:18:24 +03:00
Steven Allen
776a53a370
autorelay: break findRelays into multiple functions and avoid the goto
...
(@stebalien is picky and opinionated...)
2019-04-20 14:26:48 -07:00
Steven Allen
9fc5c962b6
Merge pull request #598 from libp2p/feat/moar-relays
...
autorelay: curtail addrsplosion
2019-04-20 13:46:20 -07:00
vyzo
8d073cec9e
kill the parallel query logic in selectRelays; let it be random
...
the presence of stashed query results from discovery in the peerstore _biases_ the
selection towards fully DHT nodes, which penalizes dedicated relays.
2019-04-20 13:34:13 +03:00
vyzo
35e805dc41
add ignore list to account for connection failures
2019-04-20 11:50:06 +03:00
vyzo
4629431a12
some tweaks
...
- select 25 of 50 relays instead of 20
- increase connect timeout to 30s
2019-04-20 11:17:10 +03:00
vyzo
f9e182f747
gate max number of retries in findRelays
2019-04-20 06:31:51 +03:00
vyzo
1a8111970b
reduce scope of the lock, pre-allocate result slice in relayAddrs
2019-04-20 06:25:37 +03:00
vyzo
5c9299a45c
pacify the race detector
2019-04-20 01:52:56 +03:00
vyzo
4727d5b849
don't preallocate result array, we don't know how long it will be
2019-04-20 01:40:29 +03:00
vyzo
c09717275b
compute relay address set dynamically
2019-04-20 00:54:44 +03:00
vyzo
f4f924e1d4
don't track relay addrs, use the peerstore
2019-04-20 00:04:26 +03:00
vyzo
bd22c49b0d
remove redundant private addr check when constructing our relay address set
...
findRelays cleans up address sets now for addrsplosion, and this removes private
addrs as well.
2019-04-19 20:49:54 +03:00
vyzo
f17a4a8667
preallocate map in sameAddrs
2019-04-19 20:03:53 +03:00
vyzo
ebc5d16f5d
use a map in sameAddrs to avoid quadratic behaviour
2019-04-19 20:03:53 +03:00
vyzo
3697552406
handle misbehaving peers in identify push
2019-04-19 20:03:53 +03:00
vyzo
c73f68bdb4
explicit Start method for basic host
2019-04-19 20:03:53 +03:00
vyzo
c9b2f468ba
reduce peer count in TestFuzzManyPeers when running under the race detector
2019-04-19 20:03:53 +03:00
vyzo
5845909754
add initialization delay in basic host background task
2019-04-19 20:03:53 +03:00
vyzo
7502fc44c9
add a background task in basic host that periodically pushes identify if needed
2019-04-19 20:03:53 +03:00
vyzo
8fa257cdf0
track context given in identify constructor and use it to gate identify push
2019-04-19 20:03:53 +03:00
vyzo
bf651ca7c7
use a single, NoDial context in identify push
2019-04-19 20:03:53 +03:00
vyzo
9b2731e5bb
used named constants for dns address protocols
2019-04-19 19:48:28 +03:00
vyzo
a8d14f9b02
use addresses from the peerstore if available
2019-04-19 14:09:56 +03:00
vyzo
ff4b98a6fc
some more addrsplosion tests
2019-04-19 13:58:45 +03:00
vyzo
21c4e1d298
test for privately bound port first when cleaning up addrsplosion
2019-04-19 13:58:10 +03:00
vyzo
528c473840
filter relay addrs in address set cleanup
2019-04-19 13:53:27 +03:00
vyzo
9d7f6b83e5
rewrite isDNSAddr to use ma.SplitFirst
2019-04-19 13:48:18 +03:00
vyzo
e82eabe130
cover the case where we can't select a default port in addrsplosion clean up
2019-04-18 14:49:42 +03:00
vyzo
a331f99b65
addrsplosion test
2019-04-18 14:42:31 +03:00
vyzo
433a0c0908
extract cleanupAddrSet and implement better heuristic
2019-04-18 14:42:06 +03:00
vyzo
4a4b14819a
add comment about eliding the lock on addrs read
2019-04-18 11:42:20 +03:00
vyzo
a88ae79f6f
use transientTTL for invalidated addrs instead of 0
2019-04-16 21:09:15 +03:00
vyzo
06391d4f2f
replace peer addresses in identify
2019-04-16 11:49:32 +03:00
vyzo
27f465ee35
some better logging
2019-04-14 21:30:59 +03:00
vyzo
0830634938
limit number of FindPeer queries in relay selection
2019-04-14 21:19:19 +03:00
vyzo
0c69da9409
move the address invalidation check outside the lock
2019-04-14 17:50:22 +03:00
vyzo
8d5c11c072
fix private->public->private transition issues with address set
2019-04-14 17:40:16 +03:00
vyzo
e8e2ab1930
limit relay selection to 20
2019-04-14 17:01:17 +03:00
vyzo
c8b8014fd0
gate retry wait with the context
2019-04-14 16:36:52 +03:00
vyzo
376379b5b8
retry to find relays if we fail to connect to any
2019-04-14 16:34:11 +03:00
vyzo
4a6e767da2
log and ignore relay peers with empty address sets
2019-04-14 16:03:58 +03:00
vyzo
081bb0f7ed
small tweak in autorelay test
2019-04-14 15:55:45 +03:00
vyzo
8c7da83b55
also check private addresses when looking for 4001
2019-04-14 15:47:46 +03:00
vyzo
da65fd74a6
fix and reinstate autorelay test
2019-04-14 15:37:20 +03:00
vyzo
45d2888617
don't drop ephemeral ports in address set clean up
2019-04-14 15:37:01 +03:00
vyzo
c9f627e221
increase FindPeer timeout to 30s
2019-04-14 15:06:15 +03:00
vyzo
31dfaf6029
increase relay advertising boot delay to 15min
2019-04-14 14:53:30 +03:00
vyzo
1138fb6040
only determine default port if it is in a public addr
2019-04-14 14:37:33 +03:00
vyzo
becb89a245
shuffle relay set before queries
2019-04-14 14:32:31 +03:00
vyzo
39f2b7ad45
fix selectRelays to return promptly when there are query errors
2019-04-14 14:25:30 +03:00
vyzo
765ed0e1a6
select 50 relays
2019-04-14 14:13:36 +03:00
vyzo
9863e22d4a
rework relay selection logic
2019-04-14 14:06:13 +03:00
vyzo
aa03a9b839
clean up relay address sets to curtail addrsplosion
2019-04-14 12:58:41 +03:00
vyzo
a1ebc4d852
reduce relay find peer and connect timeout to 30s
2019-04-13 23:46:41 +03:00
vyzo
ffd4981247
increase autorelay discovery limit to 1k
2019-04-13 22:36:29 +03:00
vyzo
1e48e15da7
respect NoDial option in routed host
2019-04-10 23:12:14 +03:00
vyzo
a4776e6174
fix panic in observed address activation check
...
The activated check cleans up, which leads to panics with concurrent reads.
This moves the seenBy set clean up into gc, where it belongs
2019-04-09 21:52:40 +03:00
vyzo
efdc140264
raise activation channel capacity to 16
2019-04-09 20:35:36 +03:00