* 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
* 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>
* Preallocate slices
* Move slice allocs to right before they're used
* Revert slice assignments to append
* Don't preallocate for tests or deprecated code
* Don't preallocate too much
* 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>
* 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>
This updates the core/crypto/secp256k1 code to make use of the
dcrec/secp256k1/v4 module directly instead of using btcec/v2 which
itself is just a shim around dcrec/secp256k1/v4 anyway.
This has the benefit of removing the additional
github.com/btcsuite/btcd/chaincfg/chainhash dependency since
dcrec/secp256k1/v4 is its own module and does rely on it.
It also updates to the latest v4.1.0 release which implements direct key
generation and has some other nice optimizations that speed up signature
verification as compared to the v4.0.1 release.
* remove TODO for PeerConnected and PeerDisconnected from Notifiee
This is now done via the event bus.
* remove OpenedStream and ClosedStream from Notifiee
* feat: harden encoding/decoding functions against panics
Part of https://github.com/libp2p/go-libp2p/issues/1389
These kinds of functions:
1. Handle user input.
2. Often have out-of-bounds, null pointer, etc bugs.
3. Have completely isolated logic where local panics are unlikely to
cause memory corruption elsewhere.
* test: add a panic catcher test
The mappings in go-cid were maintained by hand and are invalid.
More details in https://github.com/ipfs/go-cid/pull/137
This is switching to go-multicodec which has correct mappings
that are generated, not written by hand.
Co-authored-by: Daniel Martí <mvdan@mvdan.cc>
* add resource manager interfaces
* add scope accessors to streams and conns
* add ResourceManager accessor to the Network interface
* allow initially unattached streams.
* introduce service scopes, canonicalize ownership interface through setters
* make system scope explicit
* make memory stat an int64
* make the system scope a generic resource scope, introduce the DMZ
* fix typo
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* fix typo
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* rename DMZ to transient scope, remove OpenConnection from PeerScope
* remove ncopy param from GrowBuffer
* remove protocols from OpenStream
The stream is unnegotiated state until the actual protocol has been determined.
* document nil receiver contract, fix protocol scope protocol accessor method
* remove nil receiver contract requirement
* flesh out stat struct
* turn resource manager scope accessors into viewers
* interface refiniments
1. Introduce transactions in all scopes
2. Limit the view of stream/connection scope for users, to avoid the Done footgun
3. Move OpenStream to the resource manager
* add Buffer interface
* fix typo
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* fix typo
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* fix typo
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* rename user scopes to plain names, management scopes as such
* rename BeginTxn to BeginTransaction
* RIP Buffers
* make ErrResourceLimitExceeded a temporary error; move rcmgr errors with the other errors.
* unexport TemporaryError
* null resource manager stub
* unexport the null stubs, make entry point a variable
* don't rely on typed nils but instead use actual null object instances
So that we don't confuse the hell out of everyone!
* add Scope to the CapableConn interface
* rename ConnectionScope to ConnScope for consistency
* fix typo
* rename ConnectionManagementScope to ConnManagementScope
* add the ConnManagementScope to Upgrader.Upgrade
* fix argument name
* godocs for ResourceManager
* introduce MemoryStatus indicator in ReserveMemory
* use uint8 for MemoryStatus
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* rework reservation interface to pass priority instead of returning memory status
so that we don't have to undo reservations if there is too much pressure.
* improve comment
* fix typo
* export the NullScope
* Stream.SetProtocol can return an error
It needs to attach the protocol to the protocol scope, which may fail.
* merge the mux package into network
* pass the PeerScope to Multiplexer.NetConn
* Update network/rcmgr.go
Co-authored-by: raulk <raul@protocol.ai>
* Update network/rcmgr.go
Co-authored-by: raulk <raul@protocol.ai>
* Update network/rcmgr.go
Co-authored-by: raulk <raul@protocol.ai>
* Update network/rcmgr.go
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
* remove reference to deprecated mux.MuxedConn
* rename transaction to span
* indicate bytes in ReserveMemory
* break ResourceManager View methods into Viewer interface.
* add experimental interface warning
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
Co-authored-by: raulk <raul@protocol.ai>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>