vault: github.com/hashicorp/vault/vault/cluster Index | Files

package cluster

import "github.com/hashicorp/vault/vault/cluster"

Index

Package Files

cluster.go

Constants

const (
    ListenerAcceptDeadline = 500 * time.Millisecond
)

Variables

var (
    // Making this a package var allows tests to modify
    HeartbeatInterval = 5 * time.Second
)

type Client Uses

type Client interface {
    ClientLookup(context.Context, *tls.CertificateRequestInfo) (*tls.Certificate, error)
}

Client is used to lookup a client certificate.

type ClusterHook Uses

type ClusterHook interface {
    AddClient(alpn string, client Client)
    RemoveClient(alpn string)
    AddHandler(alpn string, handler Handler)
    StopHandler(alpn string)
    TLSConfig(ctx context.Context) (*tls.Config, error)
    Addr() net.Addr
}

type Handler Uses

type Handler interface {
    ServerLookup(context.Context, *tls.ClientHelloInfo) (*tls.Certificate, error)
    CALookup(context.Context) ([]*x509.Certificate, error)

    // Handoff is used to pass the connection lifetime off to
    // the handler
    Handoff(context.Context, *sync.WaitGroup, chan struct{}, *tls.Conn) error
    Stop() error
}

Handler exposes functions for looking up TLS configuration and handing off a connection for a cluster listener application.

type Listener Uses

type Listener struct {
    // contains filtered or unexported fields
}

Listener is the source of truth for cluster handlers and connection clients. It dynamically builds the cluster TLS information. It's also responsible for starting tcp listeners and accepting new cluster connections.

func NewListener Uses

func NewListener(addrs []*net.TCPAddr, cipherSuites []uint16, logger log.Logger) *Listener

func (*Listener) AddClient Uses

func (cl *Listener) AddClient(alpn string, client Client)

AddClient adds a new client for an ALPN name

func (*Listener) AddHandler Uses

func (cl *Listener) AddHandler(alpn string, handler Handler)

AddHandler registers a new cluster handler for the provided ALPN name.

func (*Listener) Addr Uses

func (cl *Listener) Addr() net.Addr

TODO: This probably isn't correct

func (*Listener) Addrs Uses

func (cl *Listener) Addrs() []*net.TCPAddr

func (*Listener) Handler Uses

func (cl *Listener) Handler(alpn string) (Handler, bool)

Handler returns the handler for the provided ALPN name

func (*Listener) RemoveClient Uses

func (cl *Listener) RemoveClient(alpn string)

RemoveClient removes the client for the specified ALPN name

func (*Listener) Run Uses

func (cl *Listener) Run(ctx context.Context) error

Run starts the tcp listeners and will accept connections until stop is called. This function blocks so should be called in a goroutine.

func (*Listener) Server Uses

func (cl *Listener) Server() *http2.Server

Server returns the http2 server that the cluster listener is using

func (*Listener) Stop Uses

func (cl *Listener) Stop()

Stop stops the cluster listner

func (*Listener) StopHandler Uses

func (cl *Listener) StopHandler(alpn string)

StopHandler stops the cluster handler for the provided ALPN name, it also calls stop on the handler.

func (*Listener) TLSConfig Uses

func (cl *Listener) TLSConfig(ctx context.Context) (*tls.Config, error)

TLSConfig returns a tls config object that uses dynamic lookups to correctly authenticate registered handlers/clients

Package cluster imports 11 packages (graph) and is imported by 4 packages. Updated 2019-07-09. Refresh now. Tools for package owners.