func (s *fileServer) initializeTLS(cert, key string) { s.TLSConfig = new(tls.Config) s.TLSConfig.MinVersion = tls.VersionTLS12 s.TLSConfig.PreferServerCipherSuites = true s.TLSConfig.CipherSuites = []uint16{ tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, } var err error s.TLSConfig.Certificates = make([]tls.Certificate, 1) s.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(cert, key) if err != nil { log.Fatal(err) } }
func (s *fileServer) listenAndServe() { log.Printf("listening on %s", s.Addr) log.Fatal(s.ListenAndServe()) }