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

Commit

Permalink
Add SecureMuxer interface to facilitate simultaneous open
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo authored and aarshkshah1992 committed Jan 12, 2021
1 parent 83ac1d3 commit 22c8a75
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sec/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 22c8a75

Please sign in to comment.