type Auth … type ServerInfo … type plainAuth … // PlainAuth returns an [Auth] that implements the PLAIN authentication // mechanism as defined in RFC 4616. The returned Auth uses the given // username and password to authenticate to host and act as identity. // Usually identity should be the empty string, to act as username. // // PlainAuth will only send the credentials if the connection is using TLS // or is connected to localhost. Otherwise authentication will fail with an // error, without sending the credentials. func PlainAuth(identity, username, password, host string) Auth { … } func isLocalhost(name string) bool { … } func (a *plainAuth) Start(server *ServerInfo) (string, []byte, error) { … } func (a *plainAuth) Next(fromServer []byte, more bool) ([]byte, error) { … } type cramMD5Auth … // CRAMMD5Auth returns an [Auth] that implements the CRAM-MD5 authentication // mechanism as defined in RFC 2195. // The returned Auth uses the given username and secret to authenticate // to the server using the challenge-response mechanism. func CRAMMD5Auth(username, secret string) Auth { … } func (a *cramMD5Auth) Start(server *ServerInfo) (string, []byte, error) { … } func (a *cramMD5Auth) Next(fromServer []byte, more bool) ([]byte, error) { … }