Commit Graph

145 Commits

Author SHA1 Message Date
galargh
50f065b4df chore: fix revive issues 2025-06-11 10:00:47 +01:00
未月
88e2f7a2bf fix(swarm): incorrect error message format order (#3037) 2024-11-12 16:23:21 -08:00
Marco Munizaga
e8b6685edb fix: swarm: refactor address resolution (#2990)
* Remove unused resolver in basic host

* Refactor Swarm.resolveAddrs

Refactors how DNS Address resolution works.

* lint

* Move MultiaddrDNSResolver interface to core

* Reserve output space for addresses left to resolve

* feat: core/transport: Add SkipResolver interface (#2989)

* Rebase on top of resolveAddrs refactor

* Add comments

* Sanitize address inputs when returning a reservation message (#3006)
2024-10-16 12:20:21 -07:00
sukun
87c435512c autonatv2: implement autonatv2 spec (#2469) 2024-06-21 14:55:22 +05:30
GoodDaisy
a759ed5548 chore: fix typos (#2694) 2024-02-05 11:29:42 -08:00
Marten Seemann
81d5c0c835 swarm: fix recursive resolving of DNS multiaddrs (#2564)
* swarm: fix recursive resolving of DNS multiaddrs

* add a test case
2023-10-25 03:40:20 -07:00
Sukun
f4b7369658 swarm: use happy eyeballs ranking for TCP dials (#2573) 2023-10-19 15:50:50 +05:30
Dennis Trautwein
1195bf500a swarm: add loopback to low timeout filter (#2595) 2023-10-12 15:18:31 +05:30
Sukun
70d31da69b swarm: fix DialPeer behaviour for transient connections (#2547) 2023-09-18 11:03:47 +05:30
Marten Seemann
32f9239693 core/peer: remove deprecated ID.Pretty method (#2565)
* core/peer: remove deprecated ID.Pretty method

* Update p2p/net/connmgr/decay.go
2023-09-13 21:36:38 -07:00
Sukun
0509445ff4 swarm: don't dial unspecified addresses (#2560)
* swarm: don't dial unspecified addresses

* add test
2023-09-07 01:22:08 -07:00
Sukun
1153b1b86b swarm: track dial cancellation reason (#2532)
* swarm: track dial cancellation reason

* fix no alloc test

* address review comments

* update panel colors
2023-08-29 19:44:06 -07:00
Marten Seemann
4caa4e5bd4 swarm: return a more meaningful error when dialing QUIC draft-29 (#2524)
* swarm: return a more meaningful error when dialing QUIC draft-29

* Apply suggestions from code review

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>

* Update p2p/net/swarm/swarm_dial.go

* fix

* better types

---------

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
2023-08-25 03:04:14 -07:00
Sukun
cd930fad90 swarm: return errors on filtered addresses when dialing (#2461) 2023-08-24 22:32:59 -07:00
Marten Seemann
63fdb48cfb update go-multiaddr to v0.10.1, use Unique function from there (#2407) 2023-07-11 01:50:50 +05:30
Sukun
1e31d70533 swarm: implement blackhole detection (#2320)
* swarm: implement blackhole detection

* address review comments
2023-06-27 12:40:06 -07:00
Sukun
046f112f8a swarm: fix stale DialBackoff comment (#2353) 2023-06-12 09:55:47 -07:00
Sukun
3d4557854a swarm: use RLock for DialBackoff reads (#2354) 2023-06-12 08:04:25 -07:00
Sukun
686a32aae7 swarm: cleanup address filtering logic (#2333) 2023-06-07 00:19:43 -07:00
Sukun
6f27081cac swarm: implement smart dialing logic (#2260)
* implement smart dialing

* add more comments and tests

* change address ranking logic to dial one quic address before others

* add randomized worker loop tests

* simplify priority queue implementation

* improve DialRanker docs

* one more test

* add explanatory comments and rename variables

* fix allocations in dialQueue

* fix allocations in dialRanker

* Apply suggestions from code review

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* fix comments

* add logging

* add holepunching test

* add metrics for tracking dial prioritisation impact

clean up redundant address filtering committed

* add test for webtransport filtering

* update changelog

* fix flaky test

* update dashboard

* update dial ranking delay dashboard to use pie chart

* change <=1ms label to 'No delay' in dashboard

* add defensive check to map presence

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2023-06-03 23:56:58 -07:00
Marten Seemann
0f9ad8c242 revert "feat:add contexts to all peerstore methods (#2312)" (#2328) 2023-06-03 16:55:08 +03:00
Prem Chaitanya Prathi
8864d1c33e feat:add contexts to all peerstore methods (#2312) 2023-06-03 02:24:50 -07:00
Marco Munizaga
e89814c520 swarm: Dedup addresses to dial (#2322)
* Dedup addresses to dial

Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>

* Move DedupAddrs test

* Typo

---------

Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>
2023-06-02 13:26:28 -07:00
Marco Munizaga
e3a16dd2a9 swarm: Check context once more before dialing (#2139) 2023-02-24 09:53:09 -08:00
Marco Munizaga
90aedbddaa Wrap conn with metrics (#2131) 2023-02-22 18:21:29 -08:00
Sukun
d9004d21b4 swarm: add ip_version to metrics (#2114)
* add ip_version to swarm metrics

* use "unknown" as a default for the IP version

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2023-02-18 15:11:18 -08:00
Marten Seemann
8ae7a37916 use quic-go and webtransport-go from quic-go organization (#2040) 2023-02-02 18:08:44 -08:00
Marten Seemann
3919359872 swarm: add a basic metrics tracer (#1973)
* swarm: add very basic metrics for opening and closing connections

* swarm: use a sync.Pool to make metrics collection allocation-free

* swarm: introduce a MetricsTracer interface

* swarm: add the transport to the dial error metric

* swarm: add Grafana dashboard

* swarm: use the prometheus namespace option
2023-01-26 16:18:55 -08:00
Marten Seemann
9e136c2531 swarm: move the additional peer ID check to the swarm
Only a subset of the transports use the ugprader (which uses the
SSMuxer). It's better to perform this check for every transport.
2022-11-20 14:29:49 +13:00
Marco Munizaga
0b4867c117 feat: quic,webtransport: enable both quic-draft29 and quic-v1 addrs on quic. only quic-v1 on webtransport (#1881)
* transport.Listener  returns a list of multiaddrs

* Support both QUIC versions in QUIC transport

* Support only QUIC v1 in webtransport

* Update dialMatcher

* Update tests

* Only use draft 29 when dialing if the server is a draft 29 server

* Removes QUIC draft 29 addrs if we have a QUIC v1 addr

* Lint fix

* Add changes to deterministic certhashes after rebase

* Update p2p/transport/quic/options.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update p2p/transport/quic/listener.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update p2p/transport/quic/quic_multiaddr.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Stylize QUIC correctly

* Update doc around ListenClose

* Preallocate a bit extra to avoid paying for an allocation later

* Keep a list of multiaddrs, then join

* PR nits

* Close transport or listener just once

* Update go-multiaddr

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2022-11-17 10:01:19 -08:00
Dennis Trautwein
2d28a045fe fix: return filtered addrs (#1855) 2022-11-08 14:52:43 -08:00
Marten Seemann
5ef3208a43 swarm: skip dialing WebTransport addresses when we have QUIC addresses (#1756) 2022-09-19 11:53:39 -07:00
Marco Munizaga
f654b4bd69 Add Resolver interface to transport (#1719)
* Add Resolver interface to transport

* Move resolve test to swarm_dial_test

* Use proper peer id in test

* Only import go-multiaddr once

* Cleanup

* Use SNI in websocket

* Update go-multiaddr

* Update p2p/net/swarm/swarm.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* PR comments on websocket.go

* Use unresolved/resolved map

* Set sni

* Refactor websocket multiaddr parsing code, add server test

* Delete superflous helpers

* Update callsites

* Fix typo in p2p/transport/websocket/websocket.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2022-09-13 09:36:26 -07:00
Marten Seemann
4623690009 switch from github.com/libp2p/go-libp2p-core to core 2022-08-17 17:13:02 +03:00
web3-bot
eff72c4afa sync: update CI config files (#1678)
* bump go.mod to Go 1.18 and run go fix

* bump go.mod to Go 1.18 and run go fix

* bump go.mod to Go 1.18 and run go fix

* bump go.mod to Go 1.18 and run go fix

* run gofmt -s

* update .github/workflows/go-test.yml

* update .github/workflows/go-check.yml

* stop using the deprecated io/ioutil package

Co-authored-by: web3-bot <web3-bot@users.noreply.github.com>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2022-08-17 01:05:51 -07:00
Marten Seemann
3d351e4ed3 swarm: mark dialing WebTransport addresses as expensive (#1650) 2022-07-09 11:34:51 -07:00
Steven Allen
c8bd6b5711 fix: return the best _acceptable_ conn in NewStream (#1604)
* fix: return the best _acceptable_ conn in NewStream

Otherwise, we can return, e.g., a transient connection that can't
actually be used.

* fix: fail dial if we can't have a usable connection

If we have a transient connection, don't want to use a transient
connection, and haven't specified "force direct dial", fail the dial.
2022-07-05 01:33:14 -07:00
Marco Munizaga
452ddfbb76 Add canonical peer status logs (#1624)
* Add canonical peer status logs

* Move logs to swarm

* Remove quic log

* Update deps
2022-07-01 12:52:39 -07:00
Steven Allen
a39f547b66 fix: deny connections to peers in the right place (#1627)
The previous location would prevent explicit calls to `Connect`, but not
implicit connections on `NewStream`. Given that the host calls `Connect`
before calling `NewStream`, it's unclear whether or not this would
likely be triggered by user code, but we still need to fix it.
2022-07-01 11:05:53 -07:00
Marten Seemann
d8c4f163a3 chore: use the new multiaddr.Contains function (#1618) 2022-06-28 01:35:22 -07:00
millken
5a06093c10 Expose DefaultPerPeerRateLimit as var (#1580)
Expose DefaultPerPeerRateLimit as var
2022-06-14 16:53:25 -07:00
vyzo
53881b2b0b refactor dialWorkerLoop into an object 2022-02-22 09:42:53 +02:00
Marten Seemann
27f2a2b82c Merge pull request #300 from libp2p/remove-addrutil
remove dependency on go-addr-util
2022-01-02 23:54:50 -08:00
Marten Seemann
a2a7e6bb42 remove dependency on go-addr-util 2022-01-03 11:45:06 +04:00
vyzo
6299c02c15 increment active dial counter 2021-12-21 11:13:02 +02:00
Marten Seemann
f545ea34aa add constructor options for timeout, stop using transport.DialTimeout 2021-12-19 19:41:03 +04:00
Marten Seemann
a32993f6ee remove addrutil.SubtractFilter 2021-12-14 16:46:32 +04:00
Marten Seemann
014b22f214 Merge pull request #277 from libp2p/sim-connect-context-direction
read and use the direction from the simultaneous connect context
2021-09-08 12:18:22 +01:00
Marten Seemann
76a1e92bd1 read and use the direction from the simultaneous connect context 2021-09-05 16:17:03 +01:00
Marten Seemann
2f389ce389 simplify starting of the dialWorkerLoop 2021-08-27 12:12:15 +01:00