Commit Graph

72 Commits

Author SHA1 Message Date
galargh
50f065b4df chore: fix revive issues 2025-06-11 10:00:47 +01:00
sukun
455a983b0e swarm_test: support more transports for GenSwarm (#3130) 2025-05-16 16:06:54 +05:30
sukun
02ab795c92 Implement error codes spec (#2927) 2025-02-09 21:39:18 +05:30
dozyio
e3b0a86e86 chore: testify fix got, expected transpositions (#2666)
* chore: testify lint fixes

* chore: revert t.error replacements

* chore: revert errNotWebSocketAddress

---------

Co-authored-by: Sukun <sukunrt@gmail.com>
2024-02-14 14:35:19 +05:30
Sukun
d08bcd9c0f mock: use go.uber.org/mock (#2540) 2023-09-13 21:35:48 -07:00
Marco Munizaga
9edef5a939 quic: drop support for QUIC draft-29 (#2487) 2023-08-15 18:15:02 -07:00
Marten Seemann
0f9ad8c242 revert "feat:add contexts to all peerstore methods (#2312)" (#2328) 2023-06-03 16:55:08 +03:00
Prem Chaitanya Prathi
8864d1c33e feat:add contexts to all peerstore methods (#2312) 2023-06-03 02:24:50 -07:00
Marten Seemann
d99606833c swarm: fix multiaddr comparison in ListenClose (#2247) 2023-04-08 11:05:50 -07: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
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
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
f401380ff1 move the resource manager mocks to this repo 2022-08-17 17:13:03 +03:00
Marten Seemann
4623690009 switch from github.com/libp2p/go-libp2p-core to core 2022-08-17 17:13:02 +03:00
Julien Muret
d7ba37217c swarm: add ListenClose (#1586)
* feat(swarm): add ListenClose

* fix(swarm): fix ListenClose behavior

* refactor(swarm): move the listener's closing log
2022-06-05 12:59:32 -07:00
Marten Seemann
39304c883f swarm: don't check return value of str.Close in TestResourceManager (#1453)
If the stream was canceled, QUIC will return an error when calling Close.
2022-04-25 10:36:02 -07:00
Marten Seemann
37f58509c0 fix flaky TestResourceManagerAcceptStream test (#1420) 2022-04-22 07:51:26 -07: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
9df9700062 add support for the resource manager 2022-01-18 11:40:40 +04:00
Marten Seemann
d12b3851b9 speed up the dial tests 2021-12-20 11:03:07 +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
212b671494 chore: update go-log to v2 (#294) 2021-12-06 23:19:13 -08:00
Marten Seemann
6d9ce0e3cf remove the ConnHandler 2021-10-18 18:21:57 +02:00
Marten Seemann
21c4486060 use functional options to configure the swarm 2021-09-08 17:33:47 +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
048c5ddc49 remove incorrect call to InterceptAddrDial
addConn is called both when we add a dialed and an accepted connection to the
swarm. InterceptAddrDial is only supposed to intercept outgoing connections
though. When dialing, we already call InterceptAddrDial when we compose the
list of dialable addresses.
2021-05-19 09:59:47 -07:00
Marten Seemann
67f91a0be9 run connection gating tests on both TCP and QUIC
Also disables one test that doesn't work with QUIC, as we always
complete the handshake before gating there.
2021-04-23 10:25:57 +07:00
Steven Allen
98d7eef950 fix: avoid returning typed nils 2021-04-20 11:37:38 -07:00
Cory Schwartz
6cc76d55e5 fix staticcheck 2021-04-21 00:40:42 +07:00
vyzo
78037d70cb make IsFdConsumingAddr a standalone utility func 2021-04-01 23:31:29 +03:00
Marten Seemann
96218e227b prevent dialing addresses that we're listening on
It's impossible to run two nodes on the same IP:port, so we know for
sure that any dial to an address that we're listening on will fail (as
the peer IDs won't match).
In practice, this will be most useful for preventing dials to localhost
for nodes that are listening on the default port.
2021-02-09 11:04:55 +08:00
Steven Allen
0526dce9ad fix: handle case where swarm closes before stream
When we close a connection, we set the "stream" set to nil to avoid opening new
stream. Unfortunately, this meant we wouldn't decrement the reference count on
the swarm.
2020-09-02 14:55:26 -07:00
Steven Allen
4bd32948e1 slim down dependencies
Removes secio, quic, and circuit dependencies. We were using them for testing
but we don't actually need them.
2020-06-24 10:38:00 -07:00
Aarsh Shah
499b4d8467 Rank Dial addresses (#212)
* Rank dial addresss.
2020-05-20 14:34:11 +05:30
Aarsh Shah
dc499b7e07 implement connection gating support: intercept peer, address dials, upgraded conns (#201) 2020-05-15 14:26:21 +01:00
Raúl Kripalani
e132f6af3f migrate to consolidated types; remove CircleCI config (#127) 2019-05-26 15:55:50 +01:00
vyzo
fb0dd0ed76 kill stray line 2019-04-10 21:48:47 +03:00
vyzo
b355bce163 update to use NoDial option from go-libp2p-net 2019-04-10 21:46:51 +03:00
vyzo
02d01da08c context option to disable dialing when opening a new stream 2019-04-10 20:24:32 +03:00
Steven Allen
4e39954ac9 refactor for new transports
Removes:

* go-libp2p-conn logic (moved to transports)
* go-libp2p-peerstream (moved here)

Changes:

* New transport interface.
* Explicit over implicit (the implicit automagic now all lives in go-libp2p):
  * No more default transports, muxers, etc.
  * No more fallback dialer. Transports are now *required*.
* Stream opening:
  * Connection picking logic (instead of just picking the first).
  * Tries harder to open a stream of some connections happen to be closed.
* Stream closing:
  * No longer treats half-closed streams as fully closed. Users *must* read the
    an EOF or reset the stream for it to be garbage collected.
* No more polling for dead connections.
* Multiplexers are now *non-optional*. Really, they haven't been optional for a
  while but we still pretended that they were.
* No more Network type alias. It added a bunch of code and didn't really provide
  anything but an alternative set of methods that do the same thing.
* Notifications:
  * New guarantee: connection open notifications will complete before connection
    close notifications begin.
  * Given that, notifications are now delivered in parallel. No more
    notification backlogs blocking connection closing/opening.
2018-06-04 19:19:48 -07:00
Steven Allen
755830ea06 test: connect each peer precisely once.
Otherwise, some tests will get confused by duplicate (temporary, we close
duplicates quickly) connections.

fixes libp2p/go-libp2p#100
2017-08-30 18:19:48 -07:00
Jeromy
9661f5e7ab gx publish 1.6.9 2017-02-03 13:05:16 -08:00
Jeromy
5c58b97791 gx publish 1.6.8 2017-02-03 11:02:21 -08:00
Jeromy
05b9ca6039 update deps 2016-10-04 21:18:07 -07:00
Jeromy
dfae5c7dd6 extract net interface and metrics 2016-10-04 13:56:20 -07:00
Jeromy
7f10dbda8b extract conn, addr-util, and testutil 2016-10-04 13:03:14 -07:00
Jeromy
17194ccda6 switch to using stdlib context package 2016-10-03 11:00:00 -07:00
Jeromy
afe0aa7f2b add note to test failure 2016-08-24 13:03:30 -07:00
Jeromy
a2a399b0ee update local import paths to reflect org change 2016-08-10 09:59:14 -07:00