Documentation ¶
Overview ¶
Package grpctls provides helper structs and functions for grpc dialing with TLS options.
This package is a work in progress and makes no API stability promises.
Index ¶
- func Creds(cfg ServerCfg) (credentials.TransportCredentials, error)
- func Dial(uri string, cfg ClientCfg, grpcOpts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialContext(ctx context.Context, uri string, cfg ClientCfg, grpcOpts ...grpc.DialOption) (*grpc.ClientConn, error)
- func Listener(uri string) (net.Listener, error)
- func ParseURI(s string) (proto string, addr string, err error)
- type ClientCfg
- type ServerCfg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Creds ¶
func Creds(cfg ServerCfg) (credentials.TransportCredentials, error)
Creds creates a transport credentials for the configuration.
func Dial ¶
func Dial(uri string, cfg ClientCfg, grpcOpts ...grpc.DialOption) (*grpc.ClientConn, error)
Dial is used for grpc client dialing
func DialContext ¶
func DialContext(ctx context.Context, uri string, cfg ClientCfg, grpcOpts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContext is used for grpc client dialing with context
Types ¶
type ClientCfg ¶
type ClientCfg struct { // CertFile path to the client certificate CertFile string `json:"certfile,omitempty"` // KeyFile path to the private key KeyFile string `json:"keyfile,omitempty"` // ServerName is used for server check validation ServerName string `json:"servername,omitempty"` // ServerCert path to the server certificate ServerCert string `json:"servercert,omitempty"` // CACert path to certification authority certificate CACert string `json:"cacert,omitempty"` // UseSystemCAs if client uses system wide CA certs UseSystemCAs bool `json:"systemca"` }
ClientCfg defines configuration for a client.
type ServerCfg ¶
type ServerCfg struct { // CertFile path to the server certificate CertFile string // KeyFile path to the private key KeyFile string // CACert path to certification authority certificate CACert string // ClientAuth if client certificate is required ClientAuth bool }
ServerCfg defines configuration for a server.
Click to show internal directories.
Click to hide internal directories.