Commit Graph

50 Commits

Author SHA1 Message Date
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
  - 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
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
Will Scott 1f18d0f3e2
Clearer naming of nat override options 2020-04-08 09:51:38 -07:00
Will Scott 685ba00833
update to current autonat interface 2020-03-19 13:27:48 -07:00
Will Scott 8037ce2dca
generation of dialer host when needed 2020-03-17 11:29:36 -07:00
Steven Allen 8248da96b0 doc(options): fix autorelay documentation
Routing is only required for autorelay when no static relays are configured.
2020-03-09 07:40:38 -07:00
Marten Seemann 68f9fd0e13 change PrivateNetwork to accept a PSK, update constructor magic 2020-03-06 18:41:16 -08:00
Vasco Santos fe2c13c71b docs: uniform comment sentences 2020-03-03 15:33:32 +01:00
Steven Allen 76944c4fc8
Merge pull request #705 from libp2p/feat/static-relays
options to configure static relays for autorelay
2020-01-17 05:22:16 -08:00
vyzo 9cd56c0bab use a global variable for default relays
and rename DefaultRelays option to DefaultStaticRelays.
2019-10-08 13:01:29 +03:00
Alex Browne 1b9b84b810 Add Filters option (#717)
The new `Filters` option allows users to take ownership of the `Filters` struct, and is suitable for cases where the addresses you want to accept/deny change dynamically.
2019-09-05 12:08:16 +01:00
vyzo 235848850e options to configure known relays for autorelay 2019-08-16 13:02:03 +03:00
Steven Allen d73a51776e new: allow overriding the user-agent with an option
Instead of using a global variable.

This also:

* Adds an option to the identify service to set the user agent.
* Removes the ability to pass an identify service to NewHost as any reasonable
  Identify service already needs to be constructed with an instance of the host.
2019-08-12 19:13:21 -07:00
Raúl Kripalani d87f89314c
Consolidate abstractions and core types into go-libp2p-core (#601) 2019-05-26 22:55:46 +01:00
vyzo fee7b01e32 add missing word 2019-04-06 18:11:33 +03:00
Steven Allen 1d8efc31aa doc: document relay options 2019-04-06 07:42:38 -07:00
vyzo a1b5b9ed53 explicit option to enable autorelay 2018-12-04 12:09:52 +02:00
vyzo 8faf5403c5 fix typo 2018-11-04 10:52:29 +02:00
vyzo d24fe6ae91 update libp2p.New constructor to construct relayed/routed hosts 2018-11-04 10:52:29 +02:00
Steven Allen d59ca83d48 switch to DisablePing instead of PingCustom 2018-10-24 07:44:25 -07:00
vyzo 1056fa8119 Ping constructor option, enabled by default 2018-10-19 12:37:20 +03:00
vyzo 5834054ad8 fix typo 2018-09-28 12:50:53 +03:00
vyzo 0600392e23 enable relay by default in New 2018-09-28 11:30:45 +03:00
Steven Allen a36d383413 add tests for NoTransports and NoListen 2018-08-21 14:40:18 -07:00
Steven Allen ad5b7b9ba6 add options for disabling the default listen address/transports
So, in go-ipfs at least, we *don't* pass the listen addresses into the libp2p
constructor. Instead, we specify them later.

This option allows us to tell libp2p to not listen by default.
2018-08-21 14:40:18 -07:00
Steven Allen 41c6834850 refactor for transport changes
Also, make the libp2p constructor fully useful. There should now be no need to
manually construct a swarm/host.
2018-06-04 21:22:24 -07:00