pacific

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadServerTLSConfig added in v0.0.2

func LoadServerTLSConfig(certPath, keyPath, caPath string) (*tls.Config, error)

LoadServerTLSConfig reads the server certificate, key, and CA certificate from the given paths and returns a tls.Config for mutual TLS.

func Logger

func Logger(ctx context.Context) zerolog.Logger

func LoggerMiddleware

func LoggerMiddleware(next http.Handler) http.Handler

Types

type Certificates added in v0.0.2

type Certificates struct {
	CACertPEM     []byte
	CAKeyPEM      []byte
	ServerCertPEM []byte
	ServerKeyPEM  []byte
	ClientCertPEM []byte
	ClientKeyPEM  []byte
}

Certificates holds the PEM-encoded keys and certificates needed to establish a mutually authenticated TLS connection.

func GenerateCertificates added in v0.0.2

func GenerateCertificates() (*Certificates, error)

GenerateCertificates creates a self-signed CA along with server and client certificates signed by that CA, suitable for mutual TLS.

func (*Certificates) ClientTLSConfig added in v0.0.2

func (c *Certificates) ClientTLSConfig() (*tls.Config, error)

ClientTLSConfig returns a tls.Config that presents the client certificate and verifies the server against the CA.

func (*Certificates) ServerTLSConfig added in v0.0.2

func (c *Certificates) ServerTLSConfig() (*tls.Config, error)

ServerTLSConfig returns a tls.Config that presents the server certificate and requires clients to present a certificate signed by the CA.

type Server

type Server[T any] struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer[T any](contextCreator func(w http.ResponseWriter, r *http.Request) T) *Server[T]

func (*Server[T]) AddRoute

func (s *Server[T]) AddRoute(method string, pattern string, handler func(T))

func (*Server[T]) Serve

func (s *Server[T]) Serve(listenAddr string) error

func (*Server[T]) ServeTLS added in v0.0.2

func (s *Server[T]) ServeTLS(listenAddr string, tlsConfig *tls.Config) error

ServeTLS listens on addr and serves over TLS using the provided config. The config's Certificates and ClientAuth fields must be set for mutual TLS.

Jump to

Keyboard shortcuts

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