go-libp2p-core icon indicating copy to clipboard operation
go-libp2p-core copied to clipboard

change interfaces for the security-in-multiaddr change

Open marten-seemann opened this issue 3 years ago • 1 comments

Changes to the Transport interface

Protocols() now returns a []ma.Protocol, not a slice of untyped ints. Note that this also changes the interpretation if more than one element is returned: So far, returning multiple protocols here meant that the Transport supports multiple protocols at the same time. Now it means that the Transports supports these protocols on top of each other. Use case: We will have one TCP Transport that handles TLS and one TCP Transport that handles Noise handshakes (the handshake protocol will be taking from the multiaddr, and not negotiated using multistream). These transports will then return [ TCP, TLS ] and [ TCP, Noise ], respectively.

Changes to the SecureTransport interface

This PR adds Protocol method, returning the handshake protocol this SecureTransport uses. Examples: plaintextv2, TLS, Noise.

marten-seemann avatar Sep 21 '21 17:09 marten-seemann

gocompat says:

Branch 'master' set up to track remote branch 'master' from 'origin'.
"github.com/libp2p/go-libp2p-core/sec".SecureTransport InterfaceChanged
"github.com/libp2p/go-libp2p-core/transport".Transport InterfaceChanged

github-actions[bot] avatar Sep 21 '21 17:09 github-actions[bot]