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

Commit

Permalink
pass the peer ID to SecureInbound in the SecureTransport and SecureMuxer
Browse files Browse the repository at this point in the history
The peer ID may be empty. This will be the common case. In that case,
connections from any peer are accepted.
  • Loading branch information
marten-seemann committed Sep 5, 2021
1 parent 094b0d3 commit 9f55be3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sec/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type SecureConn interface {
// plain-text, native connections into authenticated, encrypted connections.
type SecureTransport interface {
// SecureInbound secures an inbound connection.
SecureInbound(ctx context.Context, insecure net.Conn) (SecureConn, error)
// If p is empty, connections from any peer are accepted.
SecureInbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, error)

// SecureOutbound secures an outbound connection.
SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, error)
Expand All @@ -29,9 +30,10 @@ type SecureTransport interface {
// 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
// The returned boolean indicates whether the connection should be treated as a server
// connection; in the case of SecureInbound it should always be true.
SecureInbound(ctx context.Context, insecure net.Conn) (SecureConn, bool, error)
// If p is empty, connections from any peer are accepted.
SecureInbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, bool, error)

// SecureOutbound secures an outbound connection.
// The returned boolean indicates whether the connection should be treated as a server
Expand Down

0 comments on commit 9f55be3

Please sign in to comment.