Documentation
¶
Index ¶
Constants ¶
View Source
const ( ENV_DB_PATH = "DB_PATH" ENV_PORT = "PORT" ENV_CLIENT_CERT = "CLIENT_CERT" ENV_CLIENT_KEY = "CLIENT_KEY" ENV_CA_CERT = "CA_CERT" ENV_ENABLE_MTLS = "ENABLE_MTLS" // Client-side mTLS // Server-side mTLS environment variables ENV_SERVER_ENABLE_MTLS = "SERVER_ENABLE_MTLS" ENV_SERVER_CERT_FILE = "SERVER_CERT_FILE" ENV_SERVER_KEY_FILE = "SERVER_KEY_FILE" ENV_SERVER_CA_CERT_FILE = "SERVER_CA_CERT_FILE" )
View Source
const (
SPECIAL_OFFSET_HEARTBEAT = -1
)
Variables ¶
View Source
var ( // DBPath is the path to the SQLite database file DBPath = "./dbtest.db" Port = "8097" // Client mTLS configuration ClientCert = "" // Path to client certificate file ClientKey = "" // Path to client key file CACert = "" // Path to CA certificate file for verifying the server EnableMTLS = false // Flag to enable/disable client-side mTLS // Server mTLS configuration ServerEnableMTLS = false // Flag to enable/disable server-side mTLS ServerCertFile = "" // Path to server's certificate file ServerKeyFile = "" // Path to server's private key file ServerCACertFile = "" // Path to CA certificate file for verifying client certificates )
Functions ¶
func LoadServerTLSConfig ¶ added in v1.0.2
LoadServerTLSConfig creates and returns a *tls.Config for server-side mTLS. It loads the server's certificate and key, and the CA certificate for client authentication. Returns nil if server mTLS is not enabled or if any certificate paths are missing/invalid.
Types ¶
type ClientTLSConfig ¶ added in v1.0.2
type ClientTLSConfig struct {
CertFile string // Path to client's certificate file (PEM format)
KeyFile string // Path to client's private key file (PEM format)
CAFile string // Path to CA's certificate file (PEM format) to verify the server
}
ClientTLSConfig holds the paths to the TLS certificate files for client mTLS.
func GetClientTLSConfig ¶ added in v1.0.2
func GetClientTLSConfig() *ClientTLSConfig
GetClientTLSConfig returns a ClientTLSConfig based on the current configuration If EnableMTLS is false or if any of the required certificate paths are missing, it returns nil, which will result in an insecure connection for the client.
Click to show internal directories.
Click to hide internal directories.