transport

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package transport provides transport related functions to other kwil-db packages to help configure and use TLS clients and services.

Index

Constants

View Source
const (
	// @yaiba TODO: make this configurable
	// DefaultDialTimeout is the default dial timeout.
	DefaultDialTimeout = 3 * time.Second
	// DefaultRequestTimeout is the default request timeout.
	DefaultRequestTimeout = 3 * time.Second
)

Variables

This section is empty.

Functions

func DefaultClientTLSConfig

func DefaultClientTLSConfig() *tls.Config

DefaultClientTLSConfig returns a client tls config using just the system's CA pool, if present, otherwise an empty certificate pool.

func Dial

func Dial(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

func GenTLSKeyPair

func GenTLSKeyPair(certFile, keyFile string, org string, altDNSNames []string) error

GenTLSKeyPair generates a key/cert pair to the paths provided.

func NewClientTLSConfig

func NewClientTLSConfig(pemCerts []byte) (*tls.Config, error)

NewClientTLSConfig creates a new basic tls.Config for a TLS client. This is not appropriate for a server's config. Provide the server's certificate or it's root certificate authority.

func NewClientTLSConfigFromFile

func NewClientTLSConfigFromFile(certFile string) (*tls.Config, error)

NewClientTLSConfigFromFile creates a new basic tls.Config for a TLS client given the path to a PEM encoded certificate file to include in the root CAs. Provide the server's certificate or it's root certificate authority. Use DefaultClientTLSConfig to use just the system's CA pool.

Types

type GrpcTransport

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

func (*GrpcTransport) Dial

func (t *GrpcTransport) Dial(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

type GrpcTransporter

type GrpcTransporter interface {
	// Dial connects to the given address.
	Dial(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
}

type TimeOutOption

type TimeOutOption struct {
	Dial    time.Duration
	Request time.Duration
}

type TlsOption

type TlsOption struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL