File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "crypto/tls"
56 "fmt"
67 "io"
78 "log"
@@ -107,7 +108,25 @@ func main() {
107108 metricsHandler (w , r )
108109 })
109110 if isFile (* cert ) && isFile (* key ) {
110- log .Fatal (http .ListenAndServeTLS (addr , * cert , * key , nil ))
111+
112+ cfg := & tls.Config {
113+ MinVersion : tls .VersionTLS12 ,
114+ CipherSuites : []uint16 {
115+ tls .TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
116+ tls .TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
117+ tls .TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
118+ tls .TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
119+ tls .TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 ,
120+ tls .TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 ,
121+ },
122+ }
123+
124+ srv := & http.Server {
125+ TLSConfig : cfg ,
126+ Addr : addr ,
127+ }
128+
129+ log .Fatal (srv .ListenAndServeTLS (* cert , * key ))
111130 } else {
112131 log .Fatal (http .ListenAndServe (addr , nil ))
113132 }
You can’t perform that action at this time.
0 commit comments