package net import "crypto/tls" // DefaultTLSConfig returns a tls.Config object with system default security restrictions // This is from gtank's cryptopasta defaults // https://github.com/gtank/cryptopasta func DefaultTLSConfig() *tls.Config { return &tls.Config{ // Avoids most of the memorably-named TLS attacks MinVersion: tls.VersionTLS12, // Causes servers to use Go's default ciphersuite preferences, // which are tuned to avoid attacks. Does nothing on clients. PreferServerCipherSuites: true, // Only use curves which have constant-time implementations CurvePreferences: []tls.CurveID{ tls.X25519, tls.CurveP256, }, } }