Commit Graph

106 Commits

Author SHA1 Message Date
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 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 d72d35c025 add an integration test for the ordering of security protocols 2022-11-22 10:46:32 +13:00
Marten Seemann 1ecf340f51 config: respect the user's security protocol preference order 2022-11-22 10:46:32 +13:00
Marten Seemann e2a246d5b6 upgrader: absorb SSMuxer into the upgrader 2022-11-20 18:30:00 +13:00
Marten Seemann 133f002117 config: supply the host ID to fx
This is needed to construct the insecure transport.
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 d0704fdc7e config: forward fx output to the logger 2022-11-10 10:09:50 +00:00
Marten Seemann 479dbb93c4 restrict the Muxer option to already constructed network.Multiplexers 2022-11-10 10:09:47 +00:00
Marten Seemann cbe50095f3 config: use fx to construct security transports 2022-11-10 10:09:45 +00:00
Marten Seemann f7c8c0247b config: use fx to construct the transport upgrader 2022-11-10 10:09:38 +00:00
Marten Seemann 30e59560d3 upgrader: simplify the constructor 2022-11-10 10:07:17 +00:00
Marten Seemann 1367a62d52 use fx dependency injection to construct transports 2022-11-10 10:07:15 +00: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 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
Tshaka Eric Lekholoane fcf408c65d
identify: make the protocol version configurable (#1724)
* Configure protocolVersion for Identify protocol

Allows the protocolVersion field of the Idenfity protocol to be
configured on the host. The current value is fixed for what appears to
be for backwards compatibility with IPFS which makes it difficult for
non-IPFS protocols to use the library.

References:
  - https://github.com/libp2p/go-libp2p/issues/714
  - https://github.com/libp2p/go-libp2p/pull/1137
  - 6855ab943b/protocols/identify/src/identify.rs (L125-L127)

* Fix protocol version assignment

Fix an issue where the protocolVersion string for the Identify protocol
was wrongly being assigned the agentVersion string.

* Delete trailing whitespace
2022-09-02 01:11:41 -07:00
Steven Allen 0efe1e5093
feat: inject DNS resolver (#1607) 2022-08-22 04:04:56 -07:00
Marten Seemann 4623690009 switch from github.com/libp2p/go-libp2p-core to core 2022-08-17 17:13:02 +03:00
Marten Seemann ab634d2ba1 switch from github.com/libp2p/go-libp2p-peerstore to p2p/host/peerstore 2022-08-15 12:29:16 +03:00
Marten Seemann 6fa91535bc switch from github.com/libp2p/go-stream-muxer-multistream to p2p/muxer/muxer-multistream 2022-05-20 12:41:52 +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 43e4e51b74
rename the yamux package (#1452) 2022-04-25 12:03:16 -07:00
Marten Seemann f3bdb4b53c switch from github.com/libp2p/go-libp2p-yamux to p2p/muxer/yamux 2022-04-22 18:10:16 +01:00
Marten Seemann dfc3a3f24a switch from github.com/libp2p/go-tcp-transport to p2p/transport/tcp 2022-04-22 14:48:25 +01:00
Marten Seemann 3effab121a switch from github.com/libp2p/go-libp2p-swarm to p2p/net/swarm 2022-04-21 13:35:04 +01:00
Marten Seemann fc2c34e045 switch from github.com/libp2p/go-libp2p-blankhost to p2p/host/blank 2022-04-19 14:41:06 +01:00
Marten Seemann 7e767cbc22 correctly handle static relays 2022-03-31 11:31:05 +01:00
Marten Seemann 29fd1022a4 implement relay discovery in autorelay 2022-03-31 11:29:41 +01:00
vyzo df2301ba95 use the resource manager in libp2p bundled services, initialize default one 2022-01-18 12:27:07 +04:00
Marten Seemann 5f9c4075aa add a ResourceManager option 2022-01-18 12:25:32 +04:00
Marten Seemann 4268804809 make go-libp2p build when using the resource manager dependencies 2022-01-18 12:25:31 +04:00
Marten Seemann 4269c5f7b2 stop using go-libp2p-discovery 2022-01-16 15:32:30 +04:00
Marten Seemann d24f4f20f8 add an option for the swarm dial timeout 2022-01-04 13:37:21 +04:00
Marten Seemann 0f0cc4e4a0 use the transport.Upgrader interface 2022-01-04 13:20:59 +04:00
Marten Seemann 741348ec9c update import paths to use p2p/host/autonat 2021-12-22 13:26:20 +04:00
Marten Seemann 4141cac6f9 pass static relays to EnableAutoRelay 2021-11-14 15:33:59 +04:00
Marten Seemann e024655a40 introduce options to configure the AutoRelay 2021-11-14 14:56:47 +04:00
Gus Eggert 7a35d0df97
feat: plumb through peerstore context changes (#1237) 2021-11-12 13:43:02 -05:00
Marten Seemann d01b892679 update go-libp2p-swarm to v0.7.0 2021-10-19 10:39:32 +02:00
Marten Seemann 605f189723 check presence and type of transport constructor options 2021-09-29 15:33:25 +01:00
Marten Seemann efb3b27038 pass options to transport constructors 2021-09-29 15:33:24 +01:00
Marten Seemann 0aeef559d0 add an option to start the relay v2 2021-09-27 14:18:18 +01:00
Steven Allen f15c2a8d95
Merge pull request #1204 from libp2p/fix/allow-variadic
fix: skip variadic params in constructors
2021-09-26 16:11:12 +01:00
Steven Allen c07f74fd44 fix: skip variadic params in constructors
We use them for "options". Ideally we'd be able to forward options
through, but that would require real dependency injection.
2021-09-26 11:51:19 +01:00
vyzo 22b62cfd65
autorelay support for circuitv2 relays (#1198)
* move host/relay to host/autorelay

* move autorelay wrapper host to package

* support v2 relays in autorelay

* test autorelay with both v1 and v2 relays

* fix test race

* go mod tidy examples/pubsub/chat

static checker complains; sigh.

* refactor reservation refresh loop

* merge background and refresh goroutines

* handle pushes synchronously from reservation refresh failures

* make connmanager tag a package level constant

* dont sleep to wait for identify, use IdentifyWait

* make relay protocol ids package-level constants

* add comment about v1 relays not having reservations

* use errgrp instead of WaitGroup with atomic int

* fix variable capture bug

* go get x/sync
2021-09-25 05:47:39 -07: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 729386c495 don't use a context to shut down the circuitv2 2021-09-17 11:37:28 +02:00
Marten Seemann f3acea0d61 don't use the context to shut down the relay 2021-09-10 11:30:27 +01:00