Golang net/http.Server.ListenAndServeTLS() function example

package net/http

Golang net/http.Server.ListenAndServeTLS() function usage example

Code modified from https://www.socketloop.com/references/golang-net-http-server-listenandserve-function-and-server-type-example

 TLSServer := &http.Server{Handler: mux}
 TLSServer.Addr = "hostname:443"
 err := TLSServer.ListenAndServeTLS("server.pem", "server.key")

See also : https://www.socketloop.com/references/golang-crypto-tls-listen-and-newlistener-functions-example

References :

http://golang.org/pkg/net/http/#Server.ListenAndServeTLS

  See also : Golang net/http.Server.ListenAndServe() function and Server type example

Advertisement