1
0
mirror of https://github.com/libp2p/go-libp2p-core.git synced 2025-03-26 13:00:07 +08:00

Secure Muxer Interface ()

This commit is contained in:
Aarsh Shah 2021-02-14 17:45:11 +05:30 committed by GitHub
parent 83ac1d370d
commit a7d9ced9f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,3 +24,17 @@ type SecureTransport interface {
// SecureOutbound secures an outbound connection.
SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, error)
}
// A SecureMuxer is a wrapper around SecureTransport which can select security protocols
// and open outbound connections with simultaneous open.
type SecureMuxer interface {
// SecureInbound secures an inbound connection.
// The returned boolean indicates whether the connection should be trated as a server
// connection; in the case of SecureInbound it should always be true.
SecureInbound(ctx context.Context, insecure net.Conn) (SecureConn, bool, error)
// SecureOutbound secures an outbound connection.
// The returned boolean indicates whether the connection should be treated as a server
// connection due to simultaneous open.
SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, bool, error)
}