Commit Graph

769 Commits

Author SHA1 Message Date
Marten Seemann cefbf97aa6
webtransport: add PSK to constructor, and fail if it is used (#1929)
That way, it won't be possible to construct a host with a PSK
when WebTransport is enabled. This is desireable since WebTransport doesn't
support private network (same as QUIC).
2022-12-05 12:44:15 -08:00
Marco Munizaga 1c8eaabfd3
transport.Listener,quic: Support multiple QUIC versions with the same Listener. Only return a single multiaddr per listener. (#1923)
* Revert "transport.Listener  returns a list of multiaddrs"

This reverts commit 8962b2ae33.

* Support multiple QUIC versions on the same listener

* No long running accept loop

* Don't use a goroutine

* PR comments
2022-12-01 14:06:13 -08:00
Marten Seemann f73205096f
quic / webtransport: make it possible to listen on the same address / port (#1905)
* quic: add an integration test for QUIC version support

* quic: refactor the stateless reset test

* quic: simplify the interface of the noreuseConn

DecreaseCount now closes the underlying UDP conn, so that callers don't
need to pay attention if they're dealing with a reuseConn or a
noreuseConn.

* implement a quicreuse to manage QUIC connections

* quicreuse: introduce options

* config: construct the quicreuse.ConnManager using fx

* webtransport: use the quicreuse

* add integration test for QUIC and WebTranport sharing the same UDP addr

* Handle errors in accept loop goroutine

* Add comment

* Remove todo

* Rename mutexes

* Cleanup extra close

* Only log on err

* Use webtransport-go 0.4.0

* Fix expected error

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2022-11-28 15:55:38 -08:00
Marten Seemann 14ca991a41
transports: expose the name of the transport in the ConnectionState (#1911) 2022-11-21 17:34:02 -08:00
Marten Seemann 83b4e3cf9c expose the security protocol on the ConnectionState 2022-11-20 18:36:01 +13:00
Marten Seemann e2a246d5b6 upgrader: absorb SSMuxer into the upgrader 2022-11-20 18:30:00 +13: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
Marten Seemann 8dea194261 core/network: rename ConnectionState.NextProto to StreamMultiplexer 2022-11-20 13:23:45 +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
Marten Seemann d813808745 upgrader: pass values through a channel instead of sharing state 2022-11-17 12:42:54 +13:00
Marten Seemann 9a5faceca1 upgrader: expose the negotiated stream muxer via the ConnState 2022-11-17 12:03:28 +13:00
Marten Seemann 04a43b13a9
upgrader: absorb the muxer_multistream.Transport into the upgrader (#1885) 2022-11-16 14:09:21 -08:00
Marten Seemann cbe50095f3 config: use fx to construct security transports 2022-11-10 10:09:45 +00:00
Marten Seemann 30e59560d3 upgrader: simplify the constructor 2022-11-10 10:07:17 +00:00
Marco Munizaga da3adbc438
Fix concurrent map access in connmgr (#1860) 2022-11-08 17:06:38 -08:00
Dennis Trautwein 2d28a045fe
fix: return filtered addrs (#1855) 2022-11-08 14:52:43 -08:00
Håvard Anda Estensen 21dc42bd72
chore: preallocate slices (#1842)
* Preallocate slices

* Move slice allocs to right before they're used

* Revert slice assignments to append

* Don't preallocate for tests or deprecated code

* Don't preallocate too much
2022-11-06 04:48:40 -08:00
Marten Seemann c0a0aa010e rcmgr: make it possible to embed the NullResourceManager 2022-10-24 13:24:04 +01:00
julian88110 ebd000db1e
tls: use ALPN to negotiate the stream multiplexer (#1772)
* Muxer selection in TLS handshake first cut

* Clean up some part of the code

* Change earlydata to ConnectionState for security connection.

* resolve merging conflicts

* Add stubs for noise

* clean up code

* Switch over to passing muxers to security transport constructors

* Address feedback points

* Update p2p/net/upgrader/upgrader.go

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

* clean up accidental checked file.

* Review points round 2

* Address some go nit points

* Update tls transport test to address review points

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2022-10-07 10:34:58 -07:00
Marco Munizaga f940b1d627
Bump timeout in CI for flaky test (#1800) 2022-10-06 12:53:17 -07:00
Marten Seemann 5ef3208a43
swarm: skip dialing WebTransport addresses when we have QUIC addresses (#1756) 2022-09-19 11:53:39 -07:00
Marten Seemann 8b7d1518db
swarm: fix selection of transport for dialing (#1653)
With WebTransport's /webtransport/certhash/xyz addresses, the assumption that
the last component of a multiaddr identifies the transport to use for dialing
doesn't hold any more.
Note that WebRTC will probably also use the certhash multiaddr component to
encode its certificate hashes.
2022-09-15 22:52:51 -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
Marco Munizaga 37f12300f2
connmgr: use clock interface (#1720) 2022-08-26 08:57:45 -07:00
Marco Munizaga 6472f8cc9c
connmgr: prefer peers with no streams when closing connections (#1675)
* Prefer peers with no streams when closing connections in connmgr

* Implement Stat for test connection
2022-08-19 16:59:08 -07:00
Steven Allen bbd28365c5
fix: don't prefer local ports from other addresses when dialing (#1673)
* fix: don't prefer local ports from other addresses when dialing

This address may already be in-use (on that other address) somewhere
else.

Thanks to @schomatis for figuring this out.

fixes #1611

* chore: document reuseport dialer logic
2022-08-19 00:33:22 -07:00
Marten Seemann d4e64c727f stop using go-libp2p-testing peer ID generation functions 2022-08-17 17:37:24 +03:00
Marten Seemann f401380ff1 move the resource manager mocks to this repo 2022-08-17 17:13:03 +03: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
Jorropo efbbaa3388
chore: preallocate slices with known final size (#1679)
Found with https://github.com/alexkohler/prealloc
2022-08-16 23:56:05 -07:00
Marten Seemann ab634d2ba1 switch from github.com/libp2p/go-libp2p-peerstore to p2p/host/peerstore 2022-08-15 12:29:16 +03:00
Julien Muret 68722aa1e9
connmgr: add nowatchdog go build tag (#1666)
Add the capacity to disable watchdog even if cgo is present.
2022-08-03 15:21:23 -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 3eb35223a7
Pass endpoint information to resource manager's OpenConnection (#1633)
* Move mux testsuite to here

* Update OpenConnection call sites to pass in endpoint information

* Go mod update

* Use proper versions for deps
2022-07-01 15:43:42 -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
Marten Seemann 41cffa159e
swarm: fix logging of accepted connections (#1629) 2022-07-01 11:39:03 -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
Marten Seemann 1fd5029c8b
chore: stop using the deprecated mux.MuxedConn (#1614) 2022-06-27 10:16:40 -07:00
Marten Seemann 650c35a8b6
use multiaddr ipcidr to parse multiaddr filters (#1606) 2022-06-24 00:47:03 -07:00
millken 5a06093c10
Expose DefaultPerPeerRateLimit as var (#1580)
Expose DefaultPerPeerRateLimit as var
2022-06-14 16:53:25 -07:00
Julien Muret d7ba37217c
swarm: add ListenClose (#1586)
* feat(swarm): add ListenClose

* fix(swarm): fix ListenClose behavior

* refactor(swarm): move the listener's closing log
2022-06-05 12:59:32 -07:00
Marco Munizaga e6379f54a8
identify: Fix flaky tests (#1555)
* Fix flaky timing dependent tests

* Update go-libp2p-peerstore dependency

* Register notifiee synchronously

* Only a single connection

* Remove WaitForDisconnectNotification hack since notifs are now synchronous

* Add debug logging to identify tests

* Close chan once
2022-06-02 13:30:51 -07:00
Marten Seemann e732bda3fa
swarm: send notifications synchronously (#1562) 2022-06-01 09:41:54 -07:00
Marco Munizaga 706d13becd
Add sanity check assertion (#1570) 2022-05-31 16:03:33 -07:00
Marten Seemann 5c297a8700
swarm: speed up the TestDialWorkerLoopConcurrentFailureStress test (#1573) 2022-05-28 03:39:56 -07:00
Marten Seemann f3195e96b7
swarm: only dial a single transport in TestDialWorkerLoopBasic (#1526) 2022-05-25 12:53:14 -07:00
Marten Seemann 8d2e54e163
update go-libp2p-core, remove stream methods from network.Notifiee (#1521) 2022-05-25 06:51:37 -07:00