Commit Graph

1972 Commits

Author SHA1 Message Date
Marten Seemann 1beb093cb8 fix flaky TestAutoRelay test 2022-01-10 11:37:53 +04:00
Marten Seemann c126f37f4f speed up the autorelay test 2022-01-10 10:39:07 +04:00
Marten Seemann d5f4910af7 rename p2p/discovery/routing package, run go mod tidy 2022-01-09 22:17:04 +04:00
Marten Seemann b5056a84d2 Merge remote-tracking branch 'p2p/discovery/routing/master' into discovery-routing 2022-01-09 22:11:26 +04:00
Marten Seemann 5039dc08e9 rename p2p/discovery/util package 2022-01-09 22:10:58 +04:00
Marten Seemann 1da627d2f2 Merge remote-tracking branch 'p2p/discovery/util/master' into discovery-util 2022-01-09 22:10:00 +04:00
Marten Seemann 7c0be24a4c rename p2p/discovery/backoff package, run go mod tidy 2022-01-09 21:37:28 +04:00
Marten Seemann d3243b522b Merge remote-tracking branch 'p2p/discovery/backoff/master' into discovery 2022-01-09 21:35:36 +04:00
Marten Seemann f7b6063795
fix flaky TestStreamsStress test (#1288) 2022-01-09 04:31:41 -08:00
Marten Seemann 8f6a3dc304 rename the package to upgrader 2022-01-08 17:36:12 +04:00
Marten Seemann 445a40e4de don't start a Go routine for every connection dialed
In the swarm, we're calling Close for every connection before it is garbage
collected. We therefore don't need to start a Go routine here just to see when
a connection is closed.
We now also increment the reuse counter every time a connection is dialed. This
simplifies closing the connection.
2022-01-08 15:22:59 +04:00
Marten Seemann 0f0cc4e4a0 use the transport.Upgrader interface 2022-01-04 13:20:59 +04:00
Marten Seemann 5ffe478c08 remove the Ginkgo test suite 2022-01-04 13:05:32 +04:00
Marten Seemann 07909fc545 migrate the transport tests away from Ginkgo 2022-01-04 13:05:30 +04:00
Marten Seemann 414ea4c984 migrate the extension tests away from Ginkgo 2022-01-04 13:04:57 +04:00
Marten Seemann 74f9203514 use the transport.Upgrader interface 2022-01-04 13:03:53 +04:00
Marten Seemann c747de37d3 use the transport.Upgrader interface 2022-01-04 12:49:04 +04:00
Marten Seemann 081817c978 use the transport.Upgrader interface 2022-01-04 12:48:32 +04:00
Marten Seemann e8056e8f40 remove UpgradeInbound and UpgradeOutbound 2022-01-04 12:39:11 +04:00
Marten Seemann 078c78fb47 remove Ginkgo suite 2022-01-04 10:54:02 +04:00
Marten Seemann 2a41315ba1 migrate the tracer tests away from Ginkgo 2022-01-04 10:54:02 +04:00
Marten Seemann 6a0fe7559c migrate the reuse tests away from Ginkgo 2022-01-04 10:54:01 +04:00
Marten Seemann 415b07df91 migrate the multiaddr tests away from Ginkgo 2022-01-03 18:30:29 +04:00
Marten Seemann 4b48046ab0 migrate the listener tests away from Ginkgo 2022-01-03 18:12:40 +04:00
Marten Seemann 591c57c59e use the quic.OOBCapablePacketConn in tests 2022-01-03 17:57:23 +04:00
Marten Seemann 7a9ac66fdc migrate the conn tests away from Ginkgo 2022-01-03 17:26:32 +04:00
Marten Seemann 0e7e78b7bf migrate the transport tests away from Ginkgo 2022-01-03 17:25:58 +04:00
Marten Seemann 8a63d30904 remove dependency on the go-libp2p-peerstore/addr package (#82) 2022-01-03 01:41:26 -08:00
Marten Seemann 4d687a904c fix flaky TestBackoffDiscoveryMultipleBackoff test on CI (#80) 2022-01-03 01:36:35 -08:00
Marten Seemann 161f1c73fd remove direct dependency on libp2p/go-addr-util 2022-01-03 12:47:46 +04:00
Marten Seemann 27f2a2b82c Merge pull request #300 from libp2p/remove-addrutil
remove dependency on go-addr-util
2022-01-02 23:54:50 -08:00
Marten Seemann a2a7e6bb42 remove dependency on go-addr-util 2022-01-03 11:45:06 +04:00
Marten Seemann fa2c607656 fix flaky TestNotifications test 2022-01-03 11:08:53 +04:00
Marten Seemann 5a79888154 rename the constructor from NewUpgrader to New 2022-01-02 16:10:17 +04:00
Marten Seemann 75dda2b07a update deps and fix deprecated calls 2022-01-02 16:06:23 +04:00
Marten Seemann a3f424bc1d use the new transport.Upgrader interface 2022-01-02 15:47:58 +04:00
Marten Seemann 5eeba536ea don't use a separate Go module for the autonat tests 2022-01-02 14:47:58 +04:00
Marten Seemann c35965b869 stop using transport.DialTimeout in tests (#307) 2021-12-30 04:45:24 -08:00
Marten Seemann 741348ec9c update import paths to use p2p/host/autonat 2021-12-22 13:26:20 +04:00
Marten Seemann d3f7b82c88 Merge remote-tracking branch 'p2p/host/autonat/master' into merge-repo 2021-12-22 13:26:11 +04:00
Marten Seemann cfb9b36c95 fix flaky TestAutoNATIncomingEvents (#123) 2021-12-22 01:25:55 -08:00
Marten Seemann 09b1f8a5c5 fix flaky TestAutoNATServiceRateLimitJitter (#121) 2021-12-22 00:23:22 -08:00
Marten Seemann c63fd468ac fix flaky tests (#120) 2021-12-21 21:57:15 -08:00
Marten Seemann 2486dd78f9 speed up the tests (#119) 2021-12-21 06:44:15 -08:00
vyzo 6299c02c15 increment active dial counter 2021-12-21 11:13:02 +02:00
Marten Seemann c622cb0630 Merge pull request #97 from libp2p/reset-temp-err-catcher
reset the temporary error catcher delay after successful accept
2021-12-21 00:46:15 -08:00
Marten Seemann 67538c8ce7 Merge pull request #301 from libp2p/speedup-dial-tests
speed up the dial tests
2021-12-20 02:44:45 -08:00
Marten Seemann b16a4466da make the accept timeout configurable, stop using transport.AcceptTimeout 2021-12-20 11:46:26 +04:00
Marten Seemann f06d0dfdce reset the temporary error catcher delay after successful accept 2021-12-20 11:38:11 +04:00
Marten Seemann 15bb90236f stop using the deprecated libp2p/go-maddr-filter 2021-12-20 11:23:32 +04:00
Marten Seemann d12b3851b9 speed up the dial tests 2021-12-20 11:03:07 +04:00
Marten Seemann f545ea34aa add constructor options for timeout, stop using transport.DialTimeout 2021-12-19 19:41:03 +04:00
Marten Seemann 5155c77027
Merge pull request #1269 from libp2p/reservation-required
require the expiration field of the circuit v2 Reservation protobuf
2021-12-19 07:27:04 -08:00
Marten Seemann 9bb973c330
Merge pull request #1268 from libp2p/reconnect-on-quic
run reconnect test using QUIC
2021-12-18 10:46:45 -08:00
Marten Seemann fcf0d4267b require the expiration field of the circuit v2 Reservation protobuf 2021-12-18 20:15:36 +04:00
Marten Seemann c17d3978e6 run reconnect test using QUIC
TCP RST handling is flaky on OSX, see https://github.com/golang/go/issues/50254.
We can avoid this test from randomly failing by using QUIC instead.
2021-12-18 18:11:45 +04:00
Marten Seemann a32993f6ee remove addrutil.SubtractFilter 2021-12-14 16:46:32 +04:00
Marten Seemann e7ea19f358 remove goprocess from mock conn and link 2021-12-14 14:21:20 +04:00
Marten Seemann 47a6225cdb remove goprocess from mock net and peernet 2021-12-14 14:21:19 +04:00
Marten Seemann 56bcd81a3f use the new network.ConnStats 2021-12-13 17:26:07 +04:00
Marten Seemann ff0577ee4c always trim to the low watermark in a memory emergency 2021-12-13 17:17:12 +04:00
Marten Seemann 3412150b9c sort connections by direction and number of streams in a memory emergency 2021-12-13 17:17:12 +04:00
Marten Seemann a8a2eaa0de rework concurrency logic for trims 2021-12-13 17:17:12 +04:00
Marten Seemann 03958f6ee9 aggressively trim connections when we're running out of memory 2021-12-13 17:17:12 +04:00
Marten Seemann b1842dfdc0 fix flaky tests caused by super short silence periods 2021-12-13 17:12:24 +04:00
Marten Seemann f417a8d5ce count the number of streams on a connection for the stats 2021-12-12 18:34:37 +04:00
Marten Seemann fe89a27a3f fix flaky TestAcceptQueueBacklogged test 2021-12-12 16:34:51 +04:00
Marten Seemann 85de7f0dfb use the new network.ConnStats 2021-12-12 16:00:30 +04:00
Marten Seemann 090ba44e54 disable the 1000 streams test 2021-12-12 15:18:41 +04:00
Marten Seemann 05bb49a4bf reduce the maximum number of incoming streams to 256 (#243) 2021-12-10 02:52:18 -08:00
Marten Seemann 6f15910925 reduce the number of max incoming stream to 256
go-yamux sets a default of 1000.
2021-12-10 13:51:19 +04:00
Marten Seemann d70ee3daf2 clean up dialer peerstore after each dial 2021-12-10 13:07:06 +04:00
Marten Seemann a4e2a94e7b move the peerstoremanager to the host 2021-12-10 12:47:36 +04:00
Marten Seemann 0f76f17417
reduce the default stream protocol negotiation timeout (#1254) 2021-12-07 21:10:17 -08:00
Marten Seemann 212b671494 chore: update go-log to v2 (#294) 2021-12-06 23:19:13 -08:00
Marten Seemann 79681c8cba chore: update go-log to v2 (#242) 2021-12-06 23:17:48 -08:00
Marten Seemann 287375a12e chore: update go-log to v2 (#114) 2021-12-06 23:17:31 -08:00
Marten Seemann 73bd078ade chore: update go-log to v2 2021-12-07 10:28:26 +04:00
Marten Seemann 99e8873fd4 identify: also match observed against listening addresses 2021-12-04 14:18:33 +04:00
Marten Seemann 53eefcac56 fix missing private address reset after auto relay test 2021-12-03 18:12:47 +04:00
Marten Seemann 89fa3686d7 improve readability of addrsplosion tests 2021-12-03 17:54:29 +04:00
Marten Seemann 231f93de1a add a WithEventBus constructor option 2021-11-30 12:06:03 +04:00
Marten Seemann 414856bb95 introduce WithGracePeriod and WithSilencePeriod configuration options 2021-11-29 11:12:48 +04:00
Marten Seemann cb6c410803 remove check for the last trim time when trimming
As trims are triggered by a time.Ticker, this would lead to roughly every
second trim being skipped. It also makes calling TrimOpenConns pointless.
2021-11-29 10:38:20 +04:00
Marten Seemann e2489641e9 add an error return value to the constructor 2021-11-29 09:50:22 +04:00
Marten Seemann 4533d5ef67 add a test case 2021-11-28 19:05:04 +04:00
Marten Seemann 4aeb0b901d fix race condition in getConnsToClose 2021-11-28 18:47:05 +04:00
Marten Seemann dd821e8db9 emit the EvtPeerConnectednessChanged event 2021-11-28 17:33:21 +04:00
Marten Seemann 18939709dc chore: update go-log to v2 2021-11-28 16:37:10 +04:00
Marten Seemann 0ea56a8d6e Merge pull request #90 from libp2p/unexport-config
unexport the config
2021-11-26 11:41:31 +04:00
Marten Seemann 2d476925dd Merge pull request #88 from libp2p/update-go-log
update go-log to v2
2021-11-26 11:40:32 +04:00
Marten Seemann 7122409767 unexport the config 2021-11-26 10:57:23 +04:00
Marten Seemann 628e658092 make sure the background go routine has stopped when closing 2021-11-26 10:54:09 +04:00
Marten Seemann 44a21dc590 update go-log to v2 2021-11-26 10:50:30 +04:00
Marten Seemann adecbc72ed allow the ping protocol on transient connections 2021-11-23 16:19:42 +04:00
Marten Seemann 433e650113 set an actual NotBefore time on the certificate 2021-11-23 11:59:38 +04:00
Marten Seemann 1b09f16b42 set a random certificate issuer
According to RFC3280, the issuer field must not be empty.
2021-11-23 11:59:36 +04:00
Marten Seemann 16469528f8 make the Type field required in the HolePunch protobuf 2021-11-21 12:53:08 +04:00
Marten Seemann 8df360043e
Merge pull request #1214 from libp2p/dont-holepunch-if-no-addresses
reject hole punching attempts when we don't have any public addresses
2021-11-16 15:06:22 +04:00
Marten Seemann ac2d335505 only start hole punching service after the host has a public address 2021-11-16 14:51:15 +04:00
Marten Seemann 79db68cbce reject hole punching attempts when we don't have any public addresses 2021-11-16 14:41:04 +04:00
Marten Seemann 1464cc7073 convert the IDService to an interface 2021-11-16 14:40:41 +04:00
Marten Seemann 46953c6882 immediately get a reservation when connecting to a static relay 2021-11-16 14:31:21 +04:00
Marten Seemann f69064ed64 optimize mutex usage in the autorelay 2021-11-16 14:31:21 +04:00
Marten Seemann a03eae3b85 use the PeerConnectednessChanged event to detect relay disconnects 2021-11-16 14:31:21 +04:00
Marten Seemann 4d11bb155f discover relays in a separate go routine 2021-11-16 14:31:19 +04:00
Marten Seemann 4397bea487 use a time.Timer instead of time.After in AutoRelay 2021-11-15 21:23:07 +04: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 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
Gus Eggert 6443c8b2e7 feat: plumb peerstore contexts changes through (#75) 2021-11-10 15:50:01 -05:00
Gus Eggert 0af1a4ba3e feat: plumb peerstore contexts changes through (#75) 2021-11-10 15:50:01 -05:00
Gus Eggert d2bf1c65e0 feat: plumb through contexts from peerstore (#111) 2021-11-10 11:56:49 -05:00
Gus Eggert 8707662663 feat: plumb contexts through from peerstore (#290) 2021-11-09 10:44:28 -05:00
Steven Allen 5a1099bf7e reuse the same router until we change listeners
Technically, someone can set net.ipv4.ip_nonlocal_bind=1 to bind to
non-existent IP addresses, but I'm comfortable making this change and
seeing if anyone complains. I highly doubt it'll have any impact.

If it doesn't work out, we have other options (e.g., catch the "invalid
route" error and try again).

fixes #238
2021-10-27 17:27:35 -07:00
Marten Seemann e1335f6274 emit the EvtPeerConnectednessChanged event 2021-10-25 16:00:29 +02:00
Marten Seemann d01b892679 update go-libp2p-swarm to v0.7.0 2021-10-19 10:39:32 +02:00
Marten Seemann c3cd06d61c update go-tcp-transport to v0.4.0 2021-10-18 18:28:27 +02:00
Marten Seemann 6d9ce0e3cf remove the ConnHandler 2021-10-18 18:21:57 +02:00
Marten Seemann a157b1bd91 move isRelayAddr helper function 2021-10-12 15:09:30 +02:00
Marten Seemann 2828a61f9c move circuitv2 tests to the relay package 2021-10-12 15:09:29 +02:00
Marten Seemann 3253205d50 fix error assertions in the tracer 2021-10-11 22:59:45 +02:00
Marten Seemann e7a865296c use a random string for the mDNS peer-name 2021-10-06 14:11:48 +01:00
Marten Seemann f2edde8f9a
Merge pull request #1220 from libp2p/mdns-service-start
remove {Un}RegisterNotifee functions from mDNS service
2021-10-05 21:57:59 +01:00
Aayush Rajasekaran 7201aee2f8 Fix error log 2021-10-05 14:18:23 -04:00
Marten Seemann 7d06b23cef
Merge pull request #1213 from libp2p/fix-holepunch-structured-logging
fix structured logging in holepunch coordination
2021-10-05 15:08:53 +01:00
Marten Seemann 077325cde7 pass notifees to the mDNS constructor, add dedicated Start method 2021-10-05 13:00:44 +01:00
Marten Seemann 8f2212ab72 fix structured logging in holepunch coordination 2021-10-05 12:33:55 +01:00
Steven Allen 6139a3d9cb
Merge pull request #1212 from libp2p/fix-flaky-backpressure-test
fix flaky TestStBackpressureStreamWrite test
2021-10-04 16:53:59 -07:00
Marten Seemann d713b5b0c1
Merge pull request #1216 from libp2p/fix-mdns-test-shutdown
properly close hosts in mDNS tests
2021-10-04 19:30:31 +01:00
Marten Seemann 105f1e6b64 close the ObserverAddrManager when the ID service is closed 2021-10-03 14:44:26 +01:00
Marten Seemann d04ca6d6ad properly close hosts in mDNS tests 2021-10-03 14:10:41 +01:00
Marten Seemann 2a3f8d3546 fix flaky TestStBackpressureStreamWrite test 2021-09-29 20:34:21 +01:00
Marten Seemann 79a210072d
Merge pull request #1193 from libp2p/natmgr-remove-goprocess
remove goprocess from the NATManager
2021-09-29 13:47:44 +01:00
Marten Seemann 3e1f6683f7
Merge pull request #1197 from libp2p/use-relayv2
add an option to start the relay v2
2021-09-29 12:15:07 +01:00
Marten Seemann 72b58240e8
Merge pull request #1200 from libp2p/fix-flaky-id-test
fix flaky TestFastDisconnect identify test
2021-09-28 15:31:37 +01:00
Marten Seemann 7fa06d3cfe remove the deprecated IPFS_REUSEPORT command line flag 2021-09-27 18:56:51 +01:00
Marten Seemann 0aeef559d0 add an option to start the relay v2 2021-09-27 14:18:18 +01:00
Marten Seemann 20f296f2e9 chore: update go-tcp-transport to v0.3.0 2021-09-27 13:30:40 +01:00
Marten Seemann bd2214aab3
Merge pull request #1202 from libp2p/fix-basic-host-test-failures
fix flaky BasicHost tests
2021-09-26 16:09:56 +01:00
Marten Seemann bf0203c6d3 fix flaky BasicHost tests 2021-09-26 16:00:50 +01:00
Marten Seemann fa64faf44b
Merge pull request #1201 from libp2p/remove-detect-race
remove dependency on github.com/ipfs/go-detect-race
2021-09-26 12:13:00 +01:00
Marten Seemann eba91ac63e
Merge pull request #1191 from libp2p/fix-flaky-end-to-end-sim-connect-test
fix flaky TestEndToEndSimConnect holepunching test
2021-09-25 15:49:44 +01:00
Marten Seemann 4028c3c578 remove goprocess from the NATManager 2021-09-25 15:15:35 +01:00
Marten Seemann 5e8e3d8385 remove mapping.teardown 2021-09-25 14:50:47 +01:00
Marten Seemann 4975f0abe5 remove dependency on github.com/ipfs/go-detect-race 2021-09-25 14:29:26 +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 edff896272 add an option for the TCP connection timeout 2021-09-25 11:32:49 +01:00
Marten Seemann 79d3f044d0 use a config option to disable reuseport 2021-09-25 11:32:48 +01:00
Marten Seemann e9c99b7e62 use the assigned role when upgrading a sim open connection 2021-09-25 10:58:17 +01:00
Marten Seemann 7fa07a4aac close all connections in the TestFastDisconnect test 2021-09-24 18:49:40 +01:00
Marten Seemann 6eada787d9 fix flaky TestFastDisconnect identify test 2021-09-24 16:16:16 +01:00
Marten Seemann 7ecefa8cba reject circuitv2 reservations with nonsensical expiration times 2021-09-24 14:43:22 +01:00
Marten Seemann 893c9a40e3 chore: update go-log 2021-09-22 12:04:36 +01:00
vyzo 9674b5cda5 make hop tags and values private 2021-09-21 13:38:50 +03:00
vyzo 0d8a1852cf make tag value fixed, tagged in first circuit, untagged in last. 2021-09-21 13:37:41 +03:00
vyzo 369df59523 fix tag increment 2021-09-21 13:37:41 +03:00
vyzo 3df061d90e tag relay hops in relay implementations 2021-09-21 13:37:40 +03:00
Marten Seemann 650b013fad chore: update go-log to v2 2021-09-20 15:53:32 +01:00
vyzo d1e26810a0
Add standalone implementation of v1 Relay (#1186)
* add circuitv1 protobuf

* add implementation of v1 circuit relay

Intended to be used by standalone daemons and tests

* remove references to go-libp2p-circuit from production code

* update tests to use the in-tree v1 Relay

* use go-log/v2 in relay v1 impl

* use in-tree v1 relay in relay example

* remove go-libp2p-circuit dep from examples go.mod, go mod tidy
2021-09-20 00:29:42 -07:00
Marten Seemann af24f73bb3 fix flaky TestEndToEndSimConnect holepunching test 2021-09-20 08:20:02 +01:00
Marten Seemann 1ce83dbab1 stop using goprocess for shutdown 2021-09-19 11:06:22 +01:00
Marten Seemann 67d483bf33 update go-nat to v0.1.0 2021-09-19 11:05:47 +01:00
Marten Seemann a738e019b5 simplify dial timeout context
From the documentation:
WithDeadline returns a copy of the parent context with the deadline
adjusted to be no later than d. If the parent's deadline is already
earlier than d, WithDeadline(parent, d) is semantically equivalent to
parent.
2021-09-18 16:36:27 +02: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 a5f982ff01
Merge pull request #1185 from libp2p/circuit-shutdown
don't use a context to shut down the circuitv2
2021-09-17 18:23:41 +02:00
Marten Seemann 729386c495 don't use a context to shut down the circuitv2 2021-09-17 11:37:28 +02:00
Steven Allen 2c69c99b23 fix: remove v1 go-log dep 2021-09-15 20:01:07 +02:00
Steven Allen 97b8eb5fb5 chore: update go-log 2021-09-15 17:04:09 +02:00
Marten Seemann f3acea0d61 don't use the context to shut down the relay 2021-09-10 11:30:27 +01: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 3c25b386d9 merge branch 'hole-punching' 2021-09-08 18:23:13 +01:00
Marten Seemann fd83499ef8 Merge pull request #281 from libp2p/unexport-dial-sync
unexport the DialSync
2021-09-08 18:13:52 +01:00
Marten Seemann 0af4415ada unexport the DialSync 2021-09-08 18:05:42 +01:00
Marten Seemann 96eb4c7e1c add an error return value to the constructor 2021-09-08 17:58:30 +01: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 c2439b03ed convert the metrics reporter to an option 2021-09-08 17:34:09 +01:00
Marten Seemann 21c4486060 use functional options to configure the swarm 2021-09-08 17:33:47 +01:00
Marten Seemann 0537306605 cancel the ctx when closing, use a sync.Once to only close once 2021-09-08 17:25:49 +01:00
Marten Seemann a872d26b7c use testing.Cleanup to shut down peerstore and revert most test changes 2021-09-08 17:25:49 +01:00
Marten Seemann 782897ea41 stop using goprocess to control teardown 2021-09-08 17:25:48 +01:00
Marten Seemann b63c8ff023 use the new SecureTransport and SecureMuxer interfaces (#36)
* use the new SecureTransport and SecureMuxer interfaces

* restore sanity check for the remote peer's ID, add log statement
2021-09-08 09:15:37 -07:00
Marten Seemann 403b19ef4f Merge pull request #85 from libp2p/fix-flaky-accept-test
increase timeout in TestConnectionsClosedIfNotAccepted on CI
2021-09-08 16:50:52 +01:00
Marten Seemann bee04c7c05 read the client option from the simultaneous connect context 2021-09-08 15:22:27 +01:00
Marten Seemann 289fcae846 increase timeout in TestConnectionsClosedIfNotAccepted on CI 2021-09-08 14:51:44 +01:00
Marten Seemann e267d49e21 add the peer ID to SecureInbound 2021-09-08 12:51:22 +01:00
Marten Seemann a05bdd710b add the peer ID to SecureInbound 2021-09-08 12:41:33 +01:00
Marten Seemann 2bf69fb8d4 add the peer ID to SecureInbound 2021-09-08 12:22:46 +01:00
Marten Seemann 014b22f214 Merge pull request #277 from libp2p/sim-connect-context-direction
read and use the direction from the simultaneous connect context
2021-09-08 12:18:22 +01:00
Marten Seemann 0797df7cbc
Merge pull request #1175 from libp2p/id-service-shutdown
don't use a context for closing the ObservedAddrManager
2021-09-07 14:30:40 +01:00
Marten Seemann 964880b872
Merge pull request #1174 from libp2p/circuitv2
move the circuit v2 code here
2021-09-07 14:24:30 +01:00
Marten Seemann 9342776c9c allow concurrent calls to Close and SetTTL in the ObservedAddrManager 2021-09-07 13:48:07 +01:00
Marten Seemann 0e0111c6f5 simplify the DialSync code
It's easier to reason about this code if activeDial doesn't contain a pointer
back to DialSync (which already has a map of activeDials). It also allows us to
remove the memory footprint of the activeDial struct, so this should be
(slightly) more efficient.
2021-09-07 13:33:08 +01:00
Marten Seemann bf044ffcb7 Merge pull request #273 from libp2p/clean-up-self-dial
remove redundant self-dialing check, simplify starting of dialWorkerLoop
2021-09-07 12:43:17 +01:00
Marten Seemann b25e0b1274 stop using jbenet/go-cienv 2021-09-05 19:12:58 +01:00
Marten Seemann 2cf1c457d5 don't use a context for closing the ObservedAddrManager 2021-09-05 18:30:11 +01:00
Marten Seemann 07dbdf262f remove unnecessary sync.Once from the identify service 2021-09-05 18:07:10 +01:00
Marten Seemann 76a1e92bd1 read and use the direction from the simultaneous connect context 2021-09-05 16:17:03 +01:00