74 Commits

Author SHA1 Message Date
Marcin Rataj 41462353c6 feat: NonPublicAddrPublishing option (#3489)
Co-authored-by: Marco Munizaga <git@marcopolo.io>
2026-04-21 20:52:49 -07:00
Andrew Gillis e16f35e99a refactor: apply go fix modernizers from Go 1.26 (#3463)
Co-authored-by: sukun <sukunrt@gmail.com>
2026-02-26 12:40:50 -10: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
Marco Munizaga c4c3a34545 feat: Add WithFxOption (#2956)
* feat: Add WithFxOption

* Add get id service test
2024-10-22 11:36:40 -07: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
sukun 6861cecb3c identify: refactor observed address manager to do address mapping at thin waist(IP+TCP/UDP) layer (#2793)
* refactor observed address manager to do mapping at thin waist layer

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>

* restrict output message size, add top level option to disable address
discovery

* Comment nit

* Increase maxPeerRecordSize

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2024-05-15 20:17:25 -07:00
Håvard Anda Estensen c6e99f10af chore: remove unnecessary conversions (#2680) 2024-01-09 08:39:16 -08:00
Eric 01886871a4 Fix missing deprecation tag (#2605)
Co-authored-by: Eric McDonald <librick@users.noreply.github.com>
2023-10-16 12:08:10 +05:30
Sukun 381f23057b swarm: deprecate libp2p.DialRanker option (#2430)
* swarm: deprecate libp2p.DialRanker option

* remove whitespace diff

* Apply suggestions from code review

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

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2023-07-13 23:16:12 -07:00
Sukun 757bf59136 swarm: make black hole detection configurable (#2403)
* swarm: make black hole detection configurable

* address review comments
2023-07-06 22:42:28 -07:00
Sukun 82e6227b34 swarm: make smart-dialing opt in (#2340) 2023-06-08 22:08:03 +05:30
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
Sukun a491074d89 metrics: add options to disable metrics and to set Prometheus registerer (#2116)
* provided a WithRegisterer option for metrics

* provide a libp2p.Option to setup metrics
2023-02-20 22:48:17 -08:00
Sukun f9c02c1e46 autorelay: Split libp2p.EnableAutoRelay into 2 functions (#2022)
* Split libp2p.EnableAutoRelay into 2 functions

Provide two specific ways to enable the autorelay subsystem
libp2p.EnableAutoRelayWithStaticRelays
libp2p.EnableAutoRelayWithPeerSource

* remove minInterval from WithPeerSource

* Use PeerSource type

* Fix typo

* Update p2p/host/autorelay/options.go

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

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>
Co-authored-by: Marco Munizaga <marco@marcopolo.io>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2023-02-06 19:26:56 -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 1ecf340f51 config: respect the user's security protocol preference order 2022-11-22 10:46:32 +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 c48e78f073 remove deprecated StaticRelays option (#1868) 2022-11-11 00:23:28 -08:00
Marten Seemann bdb840fba2 autorelay: remove the default static relay option (#1867)
These relays were decomissioned recently.
2022-11-10 23:30:49 -08:00
Marten Seemann b90b74f3a5 check the options passed to transport constructor match 2022-11-10 12:42:10 +00:00
Marten Seemann 7d0b6ba933 refactor the transport constructor code to remove TransportWithOptions 2022-11-10 10:09:48 +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 1367a62d52 use fx dependency injection to construct transports 2022-11-10 10:07:15 +00:00
Marco Munizaga 0575c19f91 Add some guard rails and docs (#1863) 2022-11-08 17:12:28 -08: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
  - https://github.com/libp2p/rust-libp2p/blob/6855ab943bd7427a2135b46ad3d08f48fbf10872/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
Marten Seemann 4623690009 switch from github.com/libp2p/go-libp2p-core to core 2022-08-17 17:13:02 +03:00
Marten Seemann 6bd5e04960 switch from github.com/libp2p/go-libp2p-resource-manager to p2p/host/resource-manager 2022-08-15 13:19:13 +03:00
Marten Seemann 19090e540e docs: point to SetDefaultServiceLimits in ResourceManager option (#1636) 2022-07-03 02:44:08 -07:00
Marten Seemann 29fd1022a4 implement relay discovery in autorelay 2022-03-31 11:29:41 +01:00
Marten Seemann 5f9c4075aa add a ResourceManager option 2022-01-18 12:25:32 +04:00
Marten Seemann d24f4f20f8 add an option for the swarm dial timeout 2022-01-04 13:37:21 +04:00
Ettore Di Giacinto b4d2376986 fix typo in options.go (#1274)
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
Signed-off-by: Ettore Di Giacinto <mudler@mocaccino.org>

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2022-01-03 23:15:24 -08:00
Marten Seemann 4141cac6f9 pass static relays to EnableAutoRelay 2021-11-14 15:33:59 +04:00
Marten Seemann 9734b8d822 add a WithDefaultStaticRelays AutoRelay option 2021-11-14 14:56:48 +04: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
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
vyzo 79d995404c Use circuitv2 code (#1183)
* move circuitv2 to p2p/protocol

* update circuitv2 imports

* RIP circuit v2; use circuitv2

* fix autorelay test

* fix holepunch test

* fix relay example
2021-09-10 02:43:58 -07:00
Marten Seemann 8206fcda76 signalling for hole punching (#1168)
* hole punching protocol

* implement the new retry logic (opening a new stream per hole punch)

* rename the holepunch.HolePunchService to holepunch.Service

* remove stream handler when closing

* remove misleading comment from protobuf, add link to spec

* remove unnecessary netNotifiee.HolePunchService

* simplify receiving from the timer channel

* don't defer the closing of the hole punching stream

* only accept hole punch streams from relayed peers

* refactor error logging

* fix incorrect counting of incoming hole punch attempts

* rename HolePunch to DirectConnect

* fix usage of the wait group to close the hole punch service

* use a gc to the garbage collect the holepunch tracer

* check directionality of connection when accepting the hole punch stream

* add comment why we only call Connect once

* move deduplication logic to the holepunch service

Co-authored-by: aarshkshah1992 <aarshkshah1992@gmail.com>
2021-09-08 09:41:48 -07:00
Marten Seemann 08aaa43549 remove deprecated Filter option 2021-07-23 10:22:20 +02:00
Steven Allen 46b0ec92ff doc: document standard connection manager
Otherwise, it's completely undiscoverable.
2021-05-13 12:48:06 -07:00
Cory Schwartz 04a93f4080 static check fixes 2021-04-29 14:08:24 -07:00
vyzo b313b4af98 option for custom dns resolver 2021-04-12 12:42:56 +03:00
Raúl Kripalani d4d6adff6e make the {F=>f}iltersConnectionGater private. (#946) 2020-05-20 16:27:31 +01:00
Aarsh Shah 887f2c40cf implement connection gating at the top level (#881) 2020-05-15 17:31:03 +01:00
Will Scott c08993b4e8 switch bool to enum 2020-04-13 10:23:22 -07:00
Will Scott 5473f0ea0e clarify nat options 2020-04-10 13:12:19 -07:00
Will Scott 97be7d6b7b Expose option for setting autonat throttling 2020-04-10 12:19:52 -07:00