Source File
authentication_md5_password.go
Belonging Package
github.com/jackc/pgx/v5/pgproto3
package pgproto3import ()// AuthenticationMD5Password is a message sent from the backend indicating that an MD5 hashed password is required.type AuthenticationMD5Password struct {Salt [4]byte}// Backend identifies this message as sendable by the PostgreSQL backend.func (*AuthenticationMD5Password) () {}// Backend identifies this message as an authentication response.func (*AuthenticationMD5Password) () {}// Decode decodes src into dst. src must contain the complete message with the exception of the initial 1 byte message// type identifier and 4 byte message length.func ( *AuthenticationMD5Password) ( []byte) error {if len() != 8 {return errors.New("bad authentication message size")}:= binary.BigEndian.Uint32()if != AuthTypeMD5Password {return errors.New("bad auth type")}copy(.Salt[:], [4:8])return nil}// Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.func ( *AuthenticationMD5Password) ( []byte) []byte {= append(, 'R')= pgio.AppendInt32(, 12)= pgio.AppendUint32(, AuthTypeMD5Password)= append(, .Salt[:]...)return}// MarshalJSON implements encoding/json.Marshaler.func ( AuthenticationMD5Password) () ([]byte, error) {return json.Marshal(struct {string[4]byte}{: "AuthenticationMD5Password",: .Salt,})}// UnmarshalJSON implements encoding/json.Unmarshaler.func ( *AuthenticationMD5Password) ( []byte) error {// Ignore null, like in the main JSON package.if string() == "null" {return nil}var struct {string[4]byte}if := json.Unmarshal(, &); != nil {return}.Salt = .return nil}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |