Commit Graph

547 Commits

Author SHA1 Message Date
Marten Seemann ec3c9cbf49
implement the new mDNS spec, move the old mDNS implementation (#1161)
* move the current mdns discovery implementation to discovery_legacy

* use libp2p/zeroconf for mDNS discovery

* rename the discovery package to mdns

* don't store the context

* use a wait group for clean shutdown of the mdns resolver

* add comment about port numbers

* move the mdns packages p2p/discovery
2021-08-18 09:15:56 -07:00
Marten Seemann 82a43f7abd remove deprecated basichost.New constructor 2021-08-16 16:49:28 +02:00
Steven Allen 989fba5d32
Merge pull request #1147 from lthibault/enhancement/stateful-addr-events
Make BasicHost.evtLocalAddrsUpdated event emitter stateful.
2021-08-03 17:04:18 -07:00
godcong 99c48cfe99 fix(basic_host): stream not closed when context done 2021-08-03 22:20:39 +08:00
Louis Thibault fbcfca7ac3 Make BasicHost.evtLocalAddrsUpdated event emitter stateful. 2021-08-02 10:16:19 -04:00
Steven Allen d38694b8cd
Merge pull request #1136 from libp2p/fix/deprecated
fix: remove deprecated call
2021-07-22 15:43:40 -07:00
Steven Allen 38eb9a71cd fix: remove deprecated call 2021-07-22 15:39:35 -07:00
Marten Seemann 25d36cdd05 remove deprecated identify.ClientVersion 2021-07-22 21:49:25 +02:00
Steven Allen 219a23aa99 fix(basic_host): process address filters even when not listening
That way, `Addrs` and the addresses emitted on the event bus are always
consistent.
2021-06-29 20:46:32 -07:00
snyh cc409ae169 perf/basic_host: Don't handle address change if we hasn't anyone 2021-06-29 20:31:54 -07:00
Jakub Sztandera d82385ef70
Deterministic lock order
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2021-06-07 20:45:07 +02:00
Jakub Sztandera 79cc9a4bae
Fix race in adding connections to connsByPeer
Side A could already be running Identify with side B before B had the
connection in the connsByPeer, this lead to Connectedness returning
NotConnected and Identify failing.

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2021-06-07 18:49:09 +02:00
Steven Allen a26ef70657
Merge pull request #1103 from libp2p/speedup-mock-test
speed up the mock tests
2021-05-18 10:19:22 -07:00
Marten Seemann a2b8ed16f8 speed up the mock tests 2021-05-18 09:03:37 -07:00
Marten Seemann 2603aac445 remove slow ObservedAddrManager test that doesn't test anything 2021-05-17 20:02:04 -07:00
Steven Allen b7e0282037 test: rewrite backpressure test
We just want to make sure we don't keep writing forever if the other
side isn't reading.
2021-05-04 22:09:47 -07:00
Steven Allen e482b45c66 fix: re-expose AutoNAT service on BasicHost
Unfortunately, lotus relies on this and we don't have a good alternative
at the moment.

1. The "correct" way to get the status is to subscribe to the
"discoverability" events and read the first event (you're guaranteed to
see a "current status" event). However, this is a bit annoying.
2. Ideally, you'd call host.Addrs() to get the list of "good" addresses.
Unfortunately, we don't feed enough information back into the Host from
AutoNAT for this to be truly useful (yet).
2021-05-04 20:21:22 -07: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
Steven Allen 2ad02f79b2 chore: update to go-log v2 2021-04-29 14:15:17 -07:00
Steven Allen 2a72777ef9 fix: address review feedback 2021-04-29 14:13:54 -07:00
Cory Schwartz 12753d3795 advertise util 2021-04-29 14:12:47 -07:00
Cory Schwartz 04a93f4080 static check fixes 2021-04-29 14:08:24 -07:00
Marten Seemann 6a5da01b04
Merge pull request #1075 from coryschwartz/feat/fix-go-vet
fix go vet
2021-04-20 23:57:41 +07:00
Cory Schwartz 628f86c689 fix go vet 2021-04-14 12:27:40 -07:00
vyzo a78f048d9c fix tests 2021-04-12 13:40:10 +03:00
Steven Allen c39da30592 chore: update deps 2021-03-08 13:35:26 -08: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
vyzo 2a69faae62 use transient connections in identify streams 2021-02-25 08:45:16 +02:00
Aarsh Shah 69916ed465
Emit event for User's NAT Type i.e. Hard NAT or Easy NAT (#1042)
* emit NAT device type
2021-02-19 15:14:03 +05:30
Aarsh Shah 890f2e86b2
Close peerstore and document Host Close (#1037)
* close peerstore and docs change

* update docs
2021-01-19 10:57:34 +05:30
Aarsh Shah 1c850e1293
Timeout all Identify stream reads (#1032)
* fix: read timeouts on Identify protocols

* fixed tests

* review and go fmt
2021-01-14 11:47:05 +05:30
Marten Seemann 34eb40850b use a context when opening streams 2020-12-19 12:05:19 +07:00
Steven Allen 024f1af9ae fix: obey new stream timeout 2020-12-08 14:35:58 -08:00
Steven Allen 7a98f28856 feat: update to go-libp2p-core 0.7.0 interface changes
This patch updates go-libp2p for the stream interface changes in go-libp2p-core
0.7.0. This is a _significant_ breaking change to streams and all users should
read https://github.com/libp2p/go-libp2p-core/releases/tag/v0.7.0. In practice,
this change should remove a significant footgun.

TL;DR:

* `Stream.Close` now behaves like `net.TCPConn.Close`.
* There is a new `Stream.CloseWrite` (send an EOF) and `Stream.CloseRead` (close
  for reading), behaving like their counterparts in `net.TCPConn`.
2020-11-11 09:35:37 -08:00
vyzo 863439702d add note in godocs about non-closure of active connections to blocked entities. 2020-11-10 18:39:34 +02:00
vyzo e67928b576 word cosmetics 2020-11-10 16:08:28 +02:00
vyzo e6b6f9320b fix tests 2020-11-10 16:06:49 +02:00
vyzo 9ef1f9e49e propagate errors from datastore ops 2020-11-10 16:06:39 +02:00
vyzo 49cca12207 cosmetics 2020-11-10 15:54:42 +02:00
vyzo fd44d15e8d use a RWMutex 2020-11-10 15:53:30 +02:00
vyzo fd7f51887b add test 2020-09-14 15:56:50 +03:00
vyzo 9b78ee25e4 fix typos, add comment 2020-09-14 15:56:43 +03:00
vyzo d4be9c8028 add methods to list blocked entities 2020-09-14 15:25:46 +03:00
vyzo 9ca5c11a9e add support for persistence to datastore 2020-09-14 15:14:22 +03:00
vyzo aa8de6189d basic implementation of connection gater 2020-09-14 14:48:48 +03:00
Steven Allen b95d6ae6fd
Merge pull request #990 from fouge/feat/mdns-ipv6
Added parsing of IPv6 addresses for incoming mDNS requests
2020-08-20 09:55:50 -07:00
Cyril Fougeray 16d314cf30 Deduplicating code when parsing ipv4/ipv6 address; from the comment on the PR 2020-08-20 18:36:07 +02:00
Steven Allen de10591dd8 fix tests
1. Fix tests on go 1.15 by avoiding `string(i)`.
2. Fix the autorelay test by making relays announce fake "public" addresses. I'm
not sure how this worked before.
2020-08-19 11:03:55 -07:00