Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 4054516

Browse files
committed
Add SecureMuxer interface to facilitate simultaneous open
1 parent f61804b commit 4054516

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sec/security.go

+14
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,17 @@ type SecureTransport interface {
2424
// SecureOutbound secures an outbound connection.
2525
SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, error)
2626
}
27+
28+
// A SecureMuxer is a wrapper around SecureTransport which can select security protocols
29+
// and open outbound connections with simultaneous open.
30+
type SecureMuxer interface {
31+
// SecureInbound secures an inbound connection.
32+
// The returned boolean indicates whether the connection should be trated as a server
33+
// connection; in the case of SecureInbound it should always be true.
34+
SecureInbound(ctx context.Context, insecure net.Conn) (SecureConn, bool, error)
35+
36+
// SecureOutbound secures an outbound connection.
37+
// The returned boolean indicates whether the connection should be treated as a server
38+
// connection due to simultaneous open.
39+
SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, bool, error)
40+
}

0 commit comments

Comments
 (0)