diff options
| author | Felix Hanley <felix@userspace.com.au> | 2019-10-29 10:58:47 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2019-10-29 10:58:47 +0000 |
| commit | eda2530094e72463f6aef6e7f9bf524002e248fa (patch) | |
| tree | 66e987a6229a159c0eb19c448b3af04db5f56733 /vendor/github.com/jackc/pgx/pgproto3/authentication.go | |
| parent | fbc564026fa84c7f9142cdcf60accdf6b5bdaeaf (diff) | |
| download | dhtsearch-eda2530094e72463f6aef6e7f9bf524002e248fa.tar.gz dhtsearch-eda2530094e72463f6aef6e7f9bf524002e248fa.tar.bz2 | |
Remove vendored files and create go.mod
Diffstat (limited to 'vendor/github.com/jackc/pgx/pgproto3/authentication.go')
| -rw-r--r-- | vendor/github.com/jackc/pgx/pgproto3/authentication.go | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/vendor/github.com/jackc/pgx/pgproto3/authentication.go b/vendor/github.com/jackc/pgx/pgproto3/authentication.go deleted file mode 100644 index 77750b8..0000000 --- a/vendor/github.com/jackc/pgx/pgproto3/authentication.go +++ /dev/null @@ -1,54 +0,0 @@ -package pgproto3 - -import ( - "encoding/binary" - - "github.com/jackc/pgx/pgio" - "github.com/pkg/errors" -) - -const ( - AuthTypeOk = 0 - AuthTypeCleartextPassword = 3 - AuthTypeMD5Password = 5 -) - -type Authentication struct { - Type uint32 - - // MD5Password fields - Salt [4]byte -} - -func (*Authentication) Backend() {} - -func (dst *Authentication) Decode(src []byte) error { - *dst = Authentication{Type: binary.BigEndian.Uint32(src[:4])} - - switch dst.Type { - case AuthTypeOk: - case AuthTypeCleartextPassword: - case AuthTypeMD5Password: - copy(dst.Salt[:], src[4:8]) - default: - return errors.Errorf("unknown authentication type: %d", dst.Type) - } - - return nil -} - -func (src *Authentication) Encode(dst []byte) []byte { - dst = append(dst, 'R') - sp := len(dst) - dst = pgio.AppendInt32(dst, -1) - dst = pgio.AppendUint32(dst, src.Type) - - switch src.Type { - case AuthTypeMD5Password: - dst = append(dst, src.Salt[:]...) - } - - pgio.SetInt32(dst[sp:], int32(len(dst[sp:]))) - - return dst -} |
