utils

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 25 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTLSCertAndKey added in v1.9.0

func GenerateTLSCertAndKey(host string, validFrom time.Time, validFor time.Duration, directory string) error

GenerateTLSCertAndKey generates a self-signed X.509 certificate for a TLS server. Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.

host: Comma-separated hostnames and IPs to generate a certificate for validFrom: The time the certificate is valid from validFor: The duration the certificate is valid for directory: Path to write the files to

func GetGRPCClient added in v1.9.0

func GetGRPCClient(daprPort int) runtimev1pb.DaprClient

GetGRPCClient returns a gRPC client to connect to Dapr

func IsTruthy added in v1.9.0

func IsTruthy(val string) bool

IsTruthy returns true if a string is a truthy value. Truthy values are "y", "yes", "true", "t", "on", "1" (case-insensitive); everything else is false.

func LoggerMiddleware

func LoggerMiddleware(next http.Handler) http.Handler

LoggerMiddleware returns a middleware for gorilla/mux that logs all requests and processing times

func NewHTTPClient

func NewHTTPClient() *http.Client

NewHTTPClient returns a HTTP client configured for our tests.

func NewHTTPClientForSocket added in v1.12.0

func NewHTTPClientForSocket(socketAddr string) *http.Client

NewHTTPClientForSocket returns a HTTP client that connects to a Unix Domain Socket.

func PortFromEnv added in v1.12.0

func PortFromEnv(envName string, defaultPort int) (res int)

PortFromEnv returns a port from an env var, or the default value.

func StartServer

func StartServer(port int, appRouter func() http.Handler, allowHTTP2 bool, enableTLS bool)

StartServer starts a HTTP or HTTP2 server

Types

This section is empty.

Jump to

Keyboard shortcuts

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