Commit Graph

67 Commits

Author SHA1 Message Date
Marten Seemann d8c4f163a3 chore: use the new multiaddr.Contains function (#1618) 2022-06-28 01:35:22 -07:00
Marco Munizaga 3517eae205 autonat: fix flaky TestAutoNATPrivate (#1581)
* Use expectEvent and scale duration for CI

* Use 3 seconds
2022-06-02 02:44:02 -07:00
Marten Seemann fd697bb605 basichost: fix flaky TestSignedPeerRecordWithNoListenAddrs (#1559) 2022-06-01 04:10:41 -07:00
Marten Seemann 5c218cf55e basichost: fix flaky TestSignedPeerRecordWithNoListenAddrs (#1488) 2022-05-16 11:50:39 -07:00
Marten Seemann 3effab121a switch from github.com/libp2p/go-libp2p-swarm to p2p/net/swarm 2022-04-21 13:35:04 +01:00
Andrew Gillis e8d3df92f7 Resolve addresses when creating a new stream (#1342)
* Resolve addresses when creating a new stream

BasicHost.NewStream will try to establish a connection if one doesn't already exist.  This will fail if the hosts addresses have not yet been resolved.  This PR resolves the hosts addresses before creating the stream and possible new connection.

Fixes #1302

* Changes from review comments
2022-03-31 02:45:20 -07:00
Marten Seemann 741348ec9c update import paths to use p2p/host/autonat 2021-12-22 13:26:20 +04:00
Marten Seemann bf0203c6d3 fix flaky BasicHost tests 2021-09-26 16:00:50 +01:00
Marten Seemann b7bee3855c remove the context from the libp2p and from the Host contructor 2021-09-18 14:06:56 +02:00
Marten Seemann 29da01af70 update go-libp2p-core to v0.10.0 2021-09-17 18:50:15 +02:00
Marten Seemann 2d07a0d973 chore: update go-libp2p-autonat to v0.5.0 2021-08-30 10:57:52 +01:00
Marten Seemann 82a43f7abd remove deprecated basichost.New constructor 2021-08-16 16:49:28 +02:00
Louis Thibault fbcfca7ac3 Make BasicHost.evtLocalAddrsUpdated event emitter stateful. 2021-08-02 10:16:19 -04:00
Steven Allen c7902333be test: deflake TestProtoDowngrade
1. Don't write "nil". Not all writers handle this well.
2. Write/read an entire string.
3. Improve debuggability.
4. Move the sleep. We _don't_ need to wait for disconnect notifications.
   We _do_ need to wait for the protocol event change to propagate.
2021-04-30 17:30:36 -07:00
Steven Allen a6747e5b72 test: deflake tests 2021-04-29 22:20:44 -07:00
web3-bot 218f33bc62 run gofmt -s 2021-04-29 21:35:37 +00:00
vyzo a78f048d9c fix tests 2021-04-12 13:40:10 +03:00
Will Scott c2c5918483 fix autonat race
fix #7947
move `BasicHost.AutoNat` to a private field (it has no public method and shouldn't be accessed afaik.
Instead add a setter for config that sets it while holding the address mutex to prevent reads of the
field at the same time.
2021-02-26 23:21:36 -08:00
Steven Allen 024f1af9ae fix: obey new stream timeout 2020-12-08 14:35:58 -08:00
Will 7cfc4e645e Bump Autonat version & validate fixed call loop in .Addrs (#988)
* add test for host address with attached autonat
* bump autonat release
2020-08-03 14:33:21 -04:00
Steven Allen 9cd6aaa9ea Fix address advertisement bugs (#974)
* fix: use all interface addresses when we can't find the default route
* fix: don't add advertise unspecified addresses
* fix: resolve addresses before looking up observed addresses
* fix: only advertise global unicast
* fix: filter link-local addresses from advertisement
* test: fix basic host addr tests
2020-07-07 16:41:45 -07:00
Aarsh Shah 3a1d20b748 Filter Interface Addresses (#936)
* Filter Host Addresses
2020-05-29 19:46:58 +05:30
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
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 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
Aarsh Shah 615f125342 Remove goprocess from Host (#865)
* remove goprocess from Host
2020-04-06 11:34:45 +05:30
Aarsh Shah 82be3ee46f signal address change 2020-03-25 00:10:23 +05:30
Aarsh Shah ed4646f711 local addr updated event 2020-03-19 19:05:15 +05:30
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
Christian Muehlhaeuser 40cb489097 Fixed typos (#680)
Just a few nit-picky typo fixes.
2019-07-22 13:44:24 +01: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
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
Raúl Kripalani d87f89314c Consolidate abstractions and core types into go-libp2p-core (#601) 2019-05-26 22:55:46 +01:00
Steven Allen 63256192d7 fix buggy addr equal in test 2018-10-24 08:44:26 -07:00
Steven Allen 41c6834850 refactor for transport changes
Also, make the libp2p constructor fully useful. There should now be no need to
manually construct a swarm/host.
2018-06-04 21:22:24 -07:00
Kevin Atkinson af895a81d5 Fix most "go vet" errors. 2017-11-16 20:05:22 -05:00
Steven Allen 7cdd4bc984 Reset on error in basic_host 2017-09-13 15:49:53 -07:00
Lars Gierth 0c23c9684c Resolve /dns4, /dns6, /dnsaddr multiaddrs 2017-08-07 05:07:58 +02:00
Lars Gierth 6cbb93905b basichost: allow overriding Addrs() 2017-05-30 20:39:08 +02:00
Jeromy 104c97ed57 update go-multistream and use negotiateLazy to allow for readonly streams 2017-01-05 08:10:26 -08:00
Jeromy f4ea270ccb use set protos in identify protocol knowledge gathering 2016-11-18 15:09:18 -08:00
Jeromy f61f242f69 Extract netutil to its own package 2016-11-17 10:58:15 -08:00
Jeromy 1a53ad77b9 extract host interface 2016-10-04 16:16:24 -07:00
Jeromy cea1fe131f extract net interface and metrics 2016-10-04 13:56:20 -07:00