Commit Graph

46 Commits

Author SHA1 Message Date
galargh
50f065b4df chore: fix revive issues 2025-06-11 10:00:47 +01:00
sukun
6249e685e9 transport: add GatedMaListener type (#3186)
This introduces a new GatedMaListener type which gates conns
accepted from a manet.Listener with a gater and creates the rcmgr
scope for it. Explicitly passing the scope allows for many guardrails
that the previous interface assertion didn't.

This breaks the previous responsibility of the upgradeListener method
into two, one gating the connection initially, and the other upgrading
the connection with a security and muxer selection.

This split makes it easy to gate the connection with the resource
manager as early as possible. This is especially true for websocket
because we want to gate the connection just after the TCP connection is
established, and not after the tls handshake + websocket upgrade is
completed.
2025-03-25 22:09:57 +05:30
Marco Munizaga
785181fbb8 chore: Update go-multiaddr to v0.15 (#3145) 2025-02-24 14:21:47 -08:00
Marco Munizaga
29d83ed995 feat(transport/websocket): support SOCKS proxy with ws(s) (#3137) 2025-01-23 19:32:24 -08:00
Adin Schmahmann
5a47a90938 feat(tcpreuse): add options for sharing TCP listeners amongst TCP, WS and WSS transports (#2984)
Allows the same socket to be shared amongst TCP,WS,WSS transports.

---------

Co-authored-by: sukun <sukunrt@gmail.com>
Co-authored-by: Marco Munizaga <git@marcopolo.io>
2024-11-04 09:41:32 -08:00
Adin Schmahmann
5773e76f40 fix(websocket): re-enable websocket transport test (#2987) 2024-10-01 12:16:40 -07:00
Marten Seemann
46d1ebb465 websocket: don't resolve /dnsaddr addresses (#2571)
/dnsaddr allows forwarding to arbitrary multiaddresses. We can't assume that
the host name stays the same.
2023-09-13 23:26:58 -07:00
Marten Seemann
18c11ad204 websocket: switch back to the gorilla library (#2280)
* Revert "websocket: don't set a WSS multiaddr for accepted unencrypted conns (#2199)"

This reverts commit eeb685f68f.

* Revert "websocket: Don't limit message sizes in the websocket reader (#2193)"

This reverts commit 2fe6600ca4.

* Revert "websocket: Replace gorilla websocket transport with nhooyr websocket transport (#1982)"

* websocket: don't set a WSS multiaddr for accepted unencrypted conns
2023-05-10 21:59:03 -07:00
Marten Seemann
eeb685f68f websocket: don't set a WSS multiaddr for accepted unencrypted conns (#2199) 2023-03-16 18:39:25 -07:00
Marco Munizaga
27cce4fa78 websocket: Replace gorilla websocket transport with nhooyr websocket transport (#1982)
* Replace gorilla websocket transport with nhooyr websocket transport

* Bound read retry attempts

* Nit

* Go mod tidy

* Add comment
2023-02-06 19:35:07 -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
e2a246d5b6 upgrader: absorb SSMuxer into the upgrader 2022-11-20 18:30:00 +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
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
julian88110
7465a509d0 noise: use Noise Extension to negotiate the muxer during the handshake (#1813)
* Muxer early selection over Noise protocol

* Address review points round 2

* Muxer selection according responder's preference

* Address some review points again.

* noise: regenerate the protobuf

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2022-10-25 10:11:19 -07:00
Marten Seemann
c0a0aa010e rcmgr: make it possible to embed the NullResourceManager 2022-10-24 13:24:04 +01:00
Marco Munizaga
3e156d0813 websocket: set the HTTP host header in WSS(#1834)
* Send host header

Co-authored-by: Thibault Meunier <thibault@cloudflare.com>

* Add comment and use splithostport

* Return error

* Defer the close

Co-authored-by: Thibault Meunier <thibault@cloudflare.com>
2022-10-20 02:51:05 -07:00
Marco Munizaga
fa70f6ea48 websocket: fix nil pointer in tlsClientConf (#1770) 2022-09-21 12:37:29 -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
64cfca6beb switch from github.com/libp2p/go-libp2p-testing/suites/transport to p2p/transport/testsuite 2022-05-18 13:25:53 +02:00
Marten Seemann
9dc18edc26 switch from github.com/libp2p/go-libp2p-transport-upgrader to p2p/net/upgrader 2022-04-27 01:46:40 +02:00
Marten Seemann
de5875fd9c switch from github.com/libp2p/go-conn-security-multistream to p2p/net/conn-security-multistream 2022-04-26 13:23:15 +01:00
Marten Seemann
94ce988fbb use yamux instead of mplex in tests (#1456)
* use yamux in TCP transport tests

* use yamux in websocket tests
2022-04-26 03:19:06 -07:00
Marten Seemann
292e430e58 add an option to use encrypted websockets for listening 2022-02-17 11:48:34 +04:00
Alex Browne
a55402dd29 add support for wss dialing 2022-02-14 12:26:23 +04:00
Marten Seemann
2d53c8f4eb remove wasm support (#114) 2022-02-13 22:40:52 -08:00
Marten Seemann
abde7f483b use the resource manager 2022-01-18 09:57:29 +04:00
Marten Seemann
081817c978 use the transport.Upgrader interface 2022-01-04 12:48:32 +04:00
web3-bot
96471694fe sync: update CI config files (#106) 2021-08-17 14:46:37 +00:00
Marten Seemann
cdd2cf7e46 chore: update go-libp2p-transport-upgrader and go-libp2p-core 2021-07-24 21:01:20 +02:00
Steven Allen
9cbaa8d2f0 chore: various cleanups required to get vet/staticcheck/test to pass
Importantly: this removes WsCodec (was exported). But it's deprecated
and nobody references it anyways (we register it locally).
2021-07-14 19:03:11 -07:00
Marten Seemann
bc54bc258f pass a context to OpenStream in tests 2020-12-19 11:47:58 +07:00
Alex Browne
486168bb29 Make it possible to run browser tests with a single go test command 2019-09-30 16:59:41 -07:00
Alex Browne
a7676729b1 Implement bare bones Wasm support (needs to be cleaned up) 2019-09-30 16:59:39 -07:00
Raúl Kripalani
3255249d4e migrate to consolidated types. (#45) 2019-05-26 17:34:01 +01:00
Steven Allen
b7f9522391 dep: import go-smux-* into the libp2p org 2019-05-21 19:22:52 -07:00
Steven Allen
16e9eb2bb0 modernize request handling
I believe this was written before request hijacking was a thing. We no longer
need to hold the `ServeHTTP` function open.
2019-04-03 23:17:58 -07:00
Steven Allen
42780280b4 fixup for transport refactor
Also, use the now standardized transport tests (and fix bugs around closing the
listener).
2018-06-04 19:03:26 -07:00
Steven Allen
a88b185db2 Add write-zero test.
Just to be thorough.
2017-09-05 12:25:29 -07:00
Steven Allen
b863f44dab test concurrent connection closing 2017-09-05 12:12:21 -07:00
Jeromy
cb1cddaeb6 fix review and tests 2017-09-04 22:27:51 -07:00
dignifiedquire
84a5d64f5a refactor: simplify and split into multiple files 2017-07-09 21:04:38 +02:00