Closed achingbrain closed 1 month ago
This PR changes the method signatures compatible with the as-yet unreleased libp2p@2.x.x similar to https://github.com/ChainSafe/js-libp2p-noise/pull/440
The corresponding changes to take advantage of this PR are in https://github.com/libp2p/js-libp2p/pull/2662 and that PR is blocked on release of this one.
To allow doing things like having a single
AbortSignal
that can be used as a timeout for incoming connection establishment, allow passing it as an option to theConnectionEncrypter
secureOutbound
andsecureInbound
methods.Previously we'd wrap the stream to be secured in an
AbortableSource
, however this has some serious performance implications and it's generally better to just use a signal to cancel an ongoing operation instead of racing every chunk that comes out of the source.