config

package
v1.34.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtoGRPC  = "grpc"
	ProtoHTTP2 = "h2"
)

Variables

This section is empty.

Functions

func MutualTLS added in v1.20.7

func MutualTLS(host string) (clientTLS, serverTLS *tls.Config, err error)

MutualTLS creates client and server TLS config for mutual authentication

func NewClientTLS added in v1.34.0

func NewClientTLS(caPEM, certPEM, keyPEM []byte) (*tls.Config, error)

NewClientTLS creates client-side TLS config for mutual authentication

func NewServerTLS added in v1.34.0

func NewServerTLS(caPEM, certPEM, keyPEM []byte) (*tls.Config, error)

NewServerTLS creates server-side TLS config for mutual authentication

Types

type Config

type Config struct {
	Listen []Transport `json:"listen,omitempty"`

	Transport  Transport `json:"transport,omitempty"`
	SOCKSProxy string    `json:"socks_proxy,omitempty"`
	HTTPProxy  string    `json:"http_proxy,omitempty"`
}

func Generate added in v1.26.3

func Generate(host string) (cli, srv Config, err error)

Generate generates a pair of client and server configuration for the given host

type Transport

type Transport struct {
	Protocol string   `json:"protocol"`
	Address  string   `json:"address"`
	CertFile string   `json:"cert_file,omitempty"`
	CertPEM  []string `json:"cert_pem,omitempty"`
	KeyFile  string   `json:"key_file,omitempty"`
	KeyPEM   []string `json:"key_pem,omitempty"`
	CAFile   string   `json:"ca_file,omitempty"`
	CAPEM    []string `json:"ca_pem,omitempty"`

	// not required when using mutual TLS
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

func (Transport) CA added in v1.34.0

func (t Transport) CA() ([]byte, error)

func (Transport) Cert added in v1.34.0

func (t Transport) Cert() ([]byte, error)

func (Transport) Key added in v1.34.0

func (t Transport) Key() ([]byte, error)

Jump to

Keyboard shortcuts

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