base64HeaderBytes returns the GS2 header encoded as bytes.
()
| 325 | |
| 326 | // base64HeaderBytes returns the GS2 header encoded as bytes. |
| 327 | func (si SASLInitial) base64HeaderBytes() []byte { |
| 328 | bb := bytes.Buffer{} |
| 329 | switch si.Flag { |
| 330 | case SASLBindingFlag_NoClientSupport: |
| 331 | bb.WriteString("n,") |
| 332 | case SASLBindingFlag_AssumedNoServerSupport: |
| 333 | bb.WriteString("y,") |
| 334 | case SASLBindingFlag_Used: |
| 335 | bb.WriteString(fmt.Sprintf("p=%s,", si.BindName)) |
| 336 | } |
| 337 | bb.WriteString(si.Authzid) |
| 338 | bb.WriteRune(',') |
| 339 | return bb.Bytes() |
| 340 | } |
| 341 | |
| 342 | // Encode returns the struct as an AuthenticationSASLContinue message. |
| 343 | func (sc SASLContinue) Encode() *pgproto3.AuthenticationSASLContinue { |
no test coverage detected