Documentation ¶
Overview ¶
Package gotlsconfig makes it easy to get a secure *tls.Config for testing and development. It generates on the fly pub/private certificates. This mitigates the usage of static private keys in go code.
Its better to use self singed certificates instead of doing plain traffic!
Example ¶
package main import ( "crypto/tls" "fmt" "io" "log" "net" "os" "github.com/mschneider82/gotlsconfig" ) func main() { config := gotlsconfig.New("localhost") l, err := net.Listen("tcp", ":1234") if err != nil { log.Fatal(err) } defer l.Close() for { connp, err := l.Accept() if err != nil { log.Fatal(err) } conn := tls.Server(connp, config) go func(c net.Conn) { io.Copy(os.Stdout, c) fmt.Println() c.Close() }(conn) } }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ( EC256 = KeyType("P256") EC384 = KeyType("P384") RSA2048 = KeyType("2048") RSA4096 = KeyType("4096") RSA8192 = KeyType("8192") )
Constants for all key types we support.
Variables ¶
This section is empty.
Functions ¶
func NewWithConfig ¶
func NewWithConfig(ssconfig SelfSignedConfig) (*tls.Config, error)
NewWithConfig gets a new tls.Config with custom settings
Types ¶
Click to show internal directories.
Click to hide internal directories.