I did a while ago, but I can't share a sample. But you can build one, provided that:
1. build your server as such (note the ClientAuth - thats where magic happens):
...
rootCAs, _ := x509.SystemCertPool()
if nil == rootCAs {
rootCAs = x509.NewCertPool()
}
cfg := &tls.Config{
MinVersion: tls.VersionSSL30,
/*
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
PreferServerCipherSuites: true,
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
},
*/
ClientAuth: tls.VerifyClientCertIfGiven,
RootCAs: rootCAs,
}
cert, err := tls.LoadX509KeyPair(*publicCertificate, *privateKey)
...
srv := &http.Server{
Addr: ":8043",
Handler: handlers.RecoveryHandler(handlers.PrintRecoveryStack(true))(r),
TLSConfig: cfg,
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
}
log.Fatal(srv.ListenAndServeTLS(*publicCertificate, *privateKey))