sasl_handshake_response.go 790 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package sarama
  2. type SaslHandshakeResponse struct {
  3. Err KError
  4. EnabledMechanisms []string
  5. }
  6. func (r *SaslHandshakeResponse) encode(pe packetEncoder) error {
  7. pe.putInt16(int16(r.Err))
  8. return pe.putStringArray(r.EnabledMechanisms)
  9. }
  10. func (r *SaslHandshakeResponse) decode(pd packetDecoder, version int16) error {
  11. kerr, err := pd.getInt16()
  12. if err != nil {
  13. return err
  14. }
  15. r.Err = KError(kerr)
  16. if r.EnabledMechanisms, err = pd.getStringArray(); err != nil {
  17. return err
  18. }
  19. return nil
  20. }
  21. func (r *SaslHandshakeResponse) key() int16 {
  22. return 17
  23. }
  24. func (r *SaslHandshakeResponse) version() int16 {
  25. return 0
  26. }
  27. func (r *SaslHandshakeResponse) headerVersion() int16 {
  28. return 0
  29. }
  30. func (r *SaslHandshakeResponse) requiredVersion() KafkaVersion {
  31. return V0_10_0_0
  32. }