code: func parseLeafX509Cert(leaf *tls.Certificate) error {
  	if leaf == nil {
  		// nothing to parse for nil cert
  		return nil
  	}
  
  	if leaf.Leaf != nil {
  		// leaf cert was already parsed
  		return nil
  	}
  
  	cert, err := x509.ParseCertificate(leaf.Certificate[0])
  
  	if err != nil {
  		return err
  	}
  
  	leaf.Leaf = cert
  	return nil
  }
docs: // parseLeafX509Cert will parse an X509 certificate
  // from the TLS certificate and store the parsed
  // value in the TLS certificate as the Leaf field.