TLS Configuration
This example demonstrates configuring TLS for an HTTP server using self-signed certificates.
Running the Example
go run github.com/dioad/net/examples/tls-config
Or build and run:
cd examples/tls-config
go build
./tls-config
Then test with curl:
curl -k https://localhost:8443/
(The -k flag skips certificate verification for self-signed certificates)
What It Demonstrates
- Generating self-signed certificates programmatically
- Configuring TLS with local certificate files
- Setting up an HTTPS server with TLS
- Certificate subject and SAN configuration
- Graceful shutdown handling
Code
See main.go for the complete executable example.