MCPcopy
hub / github.com/jackc/pgx / findAuthenticationMessageType

Method findAuthenticationMessageType

pgproto3/frontend.go:425–455  ·  view source on GitHub ↗
(src []byte)

Source from the content-addressed store, hash-verified

423)
424
425func (f *Frontend) findAuthenticationMessageType(src []byte) (BackendMessage, error) {
426 if len(src) < 4 {
427 return nil, errors.New("authentication message too short")
428 }
429 f.authType = binary.BigEndian.Uint32(src[:4])
430
431 switch f.authType {
432 case AuthTypeOk:
433 return &f.authenticationOk, nil
434 case AuthTypeCleartextPassword:
435 return &f.authenticationCleartextPassword, nil
436 case AuthTypeMD5Password:
437 return &f.authenticationMD5Password, nil
438 case AuthTypeSCMCreds:
439 return nil, errors.New("AuthTypeSCMCreds is unimplemented")
440 case AuthTypeGSS:
441 return &f.authenticationGSS, nil
442 case AuthTypeGSSCont:
443 return &f.authenticationGSSContinue, nil
444 case AuthTypeSSPI:
445 return nil, errors.New("AuthTypeSSPI is unimplemented")
446 case AuthTypeSASL:
447 return &f.authenticationSASL, nil
448 case AuthTypeSASLContinue:
449 return &f.authenticationSASLContinue, nil
450 case AuthTypeSASLFinal:
451 return &f.authenticationSASLFinal, nil
452 default:
453 return nil, fmt.Errorf("unknown authentication type: %d", f.authType)
454 }
455}
456
457// GetAuthType returns the authType used in the current state of the frontend.
458// See SetAuthType for more information.

Callers 1

ReceiveMethod · 0.95

Calls 1

Uint32Method · 0.80

Tested by

no test coverage detected