Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type ClusterHook
- type Handler
- type Listener
- func (cl *Listener) AddClient(alpn string, client Client)
- func (cl *Listener) AddHandler(alpn string, handler Handler)
- func (cl *Listener) Addr() net.Addr
- func (cl *Listener) Addrs() []*net.TCPAddr
- func (cl *Listener) Handler(alpn string) (Handler, bool)
- func (cl *Listener) RemoveClient(alpn string)
- func (cl *Listener) Run(ctx context.Context) error
- func (cl *Listener) Server() *http2.Server
- func (cl *Listener) Stop()
- func (cl *Listener) StopHandler(alpn string)
- func (cl *Listener) TLSConfig(ctx context.Context) (*tls.Config, error)
Constants ¶
const (
ListenerAcceptDeadline = 500 * time.Millisecond
)
Variables ¶
var ( // Making this a package var allows tests to modify HeartbeatInterval = 5 * time.Second )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
ClientLookup(context.Context, *tls.CertificateRequestInfo) (*tls.Certificate, error)
}
Client is used to lookup a client certificate.
type ClusterHook ¶
type Handler ¶
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 ¶
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 ¶
func (*Listener) AddHandler ¶
AddHandler registers a new cluster handler for the provided ALPN name.
func (*Listener) RemoveClient ¶
RemoveClient removes the client for the specified ALPN name
func (*Listener) Run ¶
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) StopHandler ¶
StopHandler stops the cluster handler for the provided ALPN name, it also calls stop on the handler.