...

Package handshaker

import "github.com/google/s2a-go/internal/handshaker"
Overview
Index
Subdirectories

Overview ▾

Package handshaker communicates with the S2A handshaker service.

type ClientHandshakerOptions

ClientHandshakerOptions contains the options needed to configure the S2A handshaker service on the client-side.

type ClientHandshakerOptions struct {
    // MinTLSVersion specifies the min TLS version supported by the client.
    MinTLSVersion commonpb.TLSVersion
    // MaxTLSVersion specifies the max TLS version supported by the client.
    MaxTLSVersion commonpb.TLSVersion
    // TLSCiphersuites is the ordered list of ciphersuites supported by the
    // client.
    TLSCiphersuites []commonpb.Ciphersuite
    // TargetIdentities contains a list of allowed server identities. One of the
    // target identities should match the peer identity in the handshake
    // result; otherwise, the handshake fails.
    TargetIdentities []*commonpb.Identity
    // LocalIdentity is the local identity of the client application. If none is
    // provided, then the S2A will choose the default identity.
    LocalIdentity *commonpb.Identity
    // TargetName is the allowed server name, which may be used for server
    // authorization check by the S2A if it is provided.
    TargetName string
    // EnsureProcessSessionTickets allows users to wait and ensure that all
    // available session tickets are sent to S2A before a process completes.
    EnsureProcessSessionTickets *sync.WaitGroup
}

type Handshaker

Handshaker defines a handshaker interface.

type Handshaker interface {
    // ClientHandshake starts and completes a TLS handshake from the client side,
    // and returns a secure connection along with additional auth information.
    ClientHandshake(ctx context.Context) (net.Conn, credentials.AuthInfo, error)
    // ServerHandshake starts and completes a TLS handshake from the server side,
    // and returns a secure connection along with additional auth information.
    ServerHandshake(ctx context.Context) (net.Conn, credentials.AuthInfo, error)
    // Close terminates the Handshaker. It should be called when the handshake
    // is complete.
    Close() error
}

func NewClientHandshaker

func NewClientHandshaker(ctx context.Context, conn *grpc.ClientConn, c net.Conn, hsAddr string, opts *ClientHandshakerOptions) (Handshaker, error)

NewClientHandshaker creates an s2aHandshaker instance that performs a client-side TLS handshake using the S2A handshaker service.

func NewServerHandshaker

func NewServerHandshaker(ctx context.Context, conn *grpc.ClientConn, c net.Conn, hsAddr string, opts *ServerHandshakerOptions) (Handshaker, error)

NewServerHandshaker creates an s2aHandshaker instance that performs a server-side TLS handshake using the S2A handshaker service.

type ServerHandshakerOptions

ServerHandshakerOptions contains the options needed to configure the S2A handshaker service on the server-side.

type ServerHandshakerOptions struct {
    // MinTLSVersion specifies the min TLS version supported by the server.
    MinTLSVersion commonpb.TLSVersion
    // MaxTLSVersion specifies the max TLS version supported by the server.
    MaxTLSVersion commonpb.TLSVersion
    // TLSCiphersuites is the ordered list of ciphersuites supported by the
    // server.
    TLSCiphersuites []commonpb.Ciphersuite
    // LocalIdentities is the list of local identities that may be assumed by
    // the server. If no local identity is specified, then the S2A chooses a
    // default local identity.
    LocalIdentities []*commonpb.Identity
}

Subdirectories

Name Synopsis
..