func chooseAuthMechanism(desc description.Server) string {
	if desc.SaslSupportedMechs != nil {
		for _, v := range desc.SaslSupportedMechs {
			if v == SCRAMSHA256 {
				return v
			}
		}
		return SCRAMSHA1
	}

	if err := description.ScramSHA1Supported(desc.WireVersion); err == nil {
		return SCRAMSHA1
	}

	return MONGODBCR
}
// If a server provides a list of supported mechanisms, we choose
// SCRAM-SHA-256 if it exists or else MUST use SCRAM-SHA-1.
// Otherwise, we decide based on what is supported.
If a server provides a list of supported mechanisms, we choose
SCRAM-SHA-256 if it exists or else MUST use SCRAM-SHA-1.
Otherwise, we decide based on what is supported.
// If a server provides a list of supported mechanisms we choose // SCRAM - SHA - 256 if it exists or else MUST use SCRAM - SHA - 1 . // Otherwise we decide based on what is supported .
func chooseAuthMechanism(desc description.Server) string {
	if desc.SaslSupportedMechs != nil {
		for _, v := range desc.SaslSupportedMechs {
			if v == SCRAMSHA256 {
				return v
			}
		}
		return SCRAMSHA1
	}
	if err := description.ScramSHA1Supported(desc.WireVersion); err == nil {
		return SCRAMSHA1
	}
	return MONGODBCR
}
func chooseAuthMechanism ( desc description . Server ) string { if desc . SaslSupportedMechs != nil { for _ , v := range desc . SaslSupportedMechs { if v == SCRAMSHA256 { return v } } return SCRAMSHA1 } if err := description . ScramSHA1Supported ( desc . WireVersion ) ; err == nil { return SCRAMSHA1 } return MONGODBCR }
If a server provides a list of supported mechanisms, we choose
SCRAM-SHA-256 if it exists or else MUST use SCRAM-SHA-1.
If a server provides a list of supported mechanisms we choose SCRAM - SHA - 256 if it exists or else MUST use SCRAM - SHA - 1 .