Debian Codegraph @

connection_handshake.go

raw symbols SCIP
1 package rethinkdbscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/
2
3 import (
4 "bufioscip-go gomod github.com/golang/go/src go1.14 bufio/"
5 "crypto/hmacscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/"
6 "crypto/randscip-go gomod github.com/golang/go/src go1.14 `crypto/rand`/"
7 "crypto/sha256scip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/"
8 "encoding/base64scip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/"
9 "encoding/binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/"
10 "encoding/jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/"
11 "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/"
12 "hashscip-go gomod github.com/golang/go/src go1.14 hash/"
13 "ioscip-go gomod github.com/golang/go/src go1.14 io/"
14 "strconvscip-go gomod github.com/golang/go/src go1.14 strconv/"
15 "stringsscip-go gomod github.com/golang/go/src go1.14 strings/"
16
17 "golang.org/x/crypto/pbkdf2scip-go gomod golang.org/x/crypto 78000ba7a073 `golang.org/x/crypto/pbkdf2`/"
18
19 pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/ "gopkg.in/rethinkdb/rethinkdb-go.v6/ql2scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/"
20 )
21
22 type HandshakeVersionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeVersion# int
23
24 const (
25 HandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeV1_0. HandshakeVersionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeVersion# = iota
26 HandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeV0_4.
27 )
28
29 type connectionHandshakescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshake# interface {
30 Sendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshake#Send.() error
31 }
32
33 func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) handshakescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#handshake().(version HandshakeVersionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeVersion#) (connectionHandshakescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshake#, error) {
34 switch version {
35 case HandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeV0_4.:
36 return &connectionHandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#{connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn.: c}, nil
37 case HandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/HandshakeV1_0.:
38 return &connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#{connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn.: c}, nil
39 default:
40 return nil, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("Unrecognised handshake version")
41 }
42 }
43
44 type connectionHandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4# struct {
45 connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn. *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#
46 }
47
48 func (c *connectionHandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#) Sendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#Send().() error {
49 // Send handshake request
50 if err := c.writeHandshakeReqscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#writeHandshakeReq().(); err != nil {
51 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
52 return RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())}
53 }
54 // Read handshake response
55 if err := c.readHandshakeSuccessscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#readHandshakeSuccess().(); err != nil {
56 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
57 return RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())}
58 }
59
60 return nil
61 }
62
63 func (c *connectionHandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#) writeHandshakeReqscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#writeHandshakeReq().() error {
64 pos := 0
65 dataLen := 4 + 4 + len(c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..AuthKeyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#AuthKey.) + 4
66 data := make([]byte, dataLen)
67
68 // Send the protocol version to the server as a 4-byte little-endian-encoded integer
69 binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint32().(data[pos:], uint32(pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.VersionDummy_V0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/VersionDummy_V0_4.))
70 pos += 4
71
72 // Send the length of the auth key to the server as a 4-byte little-endian-encoded integer
73 binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint32().(data[pos:], uint32(len(c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..AuthKeyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#AuthKey.)))
74 pos += 4
75
76 // Send the auth key as an ASCII string
77 if len(c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..AuthKeyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#AuthKey.) > 0 {
78 pos += copy(data[pos:], c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..AuthKeyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#AuthKey.)
79 }
80
81 // Send the protocol type as a 4-byte little-endian-encoded integer
82 binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint32().(data[pos:], uint32(pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.VersionDummy_JSONscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/VersionDummy_JSON.))
83 pos += 4
84
85 return c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..writeDatascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#writeData().(data)
86 }
87
88 func (c *connectionHandshakeV0_4scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#) readHandshakeSuccessscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#readHandshakeSuccess().() error {
89 reader := bufioscip-go gomod github.com/golang/go/src go1.14 bufio/.NewReaderscip-go gomod github.com/golang/go/src go1.14 bufio/NewReader().(c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV0_4#conn..Connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Conn.)
90 line, err := reader.ReadBytesscip-go gomod github.com/golang/go/src go1.14 bufio/Reader#ReadBytes().('\x00')
91 if err != nil {
92 if err == ioscip-go gomod github.com/golang/go/src go1.14 io/.EOFscip-go gomod github.com/golang/go/src go1.14 io/EOF. {
93 return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("Unexpected EOF: %s", string(line))
94 }
95 return err
96 }
97 // convert to string and remove trailing NUL byte
98 response := string(line[:len(line)-1])
99 if response != "SUCCESS" {
100 response = stringsscip-go gomod github.com/golang/go/src go1.14 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.14 strings/TrimSpace().(response)
101 // we failed authorization or something else terrible happened
102 return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Server dropped connection with message: \"%s\"", response))}
103 }
104
105 return nil
106 }
107
108 const (
109 handshakeV1_0_protocolVersionNumberscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_protocolVersionNumber. = 0
110 handshakeV1_0_authenticationMethodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_authenticationMethod. = "SCRAM-SHA-256"
111 )
112
113 type connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0# struct {
114 connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn. *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#
115 readerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#reader. *bufioscip-go gomod github.com/golang/go/src go1.14 bufio/.Readerscip-go gomod github.com/golang/go/src go1.14 bufio/Reader#
116
117 authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg. string
118 }
119
120 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) Sendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#Send().() error {
121 c.readerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#reader. = bufioscip-go gomod github.com/golang/go/src go1.14 bufio/.NewReaderscip-go gomod github.com/golang/go/src go1.14 bufio/NewReader().(c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Conn.)
122
123 // Generate client nonce
124 clientNonce, err := c.generateNoncescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#generateNonce().()
125 if err != nil {
126 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
127 return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Failed to generate client nonce: %s", err))}
128 }
129 // Send client first message
130 if err := c.writeFirstMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeFirstMessage().(clientNonce); err != nil {
131 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
132 return err
133 }
134 // Read status
135 if err := c.checkServerVersionsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#checkServerVersions().(); err != nil {
136 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
137 return err
138 }
139
140 // Read server first message
141 i, salt, serverNonce, err := c.readFirstMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readFirstMessage().()
142 if err != nil {
143 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
144 return err
145 }
146
147 // Check server nonce
148 if !stringsscip-go gomod github.com/golang/go/src go1.14 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.14 strings/HasPrefix().(serverNonce, clientNonce) {
149 return RQLAuthErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLAuthError#{RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#("Invalid nonce from server")}}
150 }
151
152 // Generate proof
153 saltedPass := c.saltPasswordscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#saltPassword().(i, salt)
154 clientProof := c.calculateProofscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#calculateProof().(saltedPass, clientNonce, serverNonce)
155 serverSignature := c.serverSignaturescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#serverSignature().(saltedPass)
156
157 // Send client final message
158 if err := c.writeFinalMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeFinalMessage().(serverNonce, clientProof); err != nil {
159 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
160 return err
161 }
162 // Read server final message
163 if err := c.readFinalMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readFinalMessage().(serverSignature); err != nil {
164 c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().()
165 return err
166 }
167
168 return nil
169 }
170
171 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) writeFirstMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeFirstMessage().(clientNonce string) error {
172 // Default username to admin if not set
173 username := "admin"
174 if c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..Usernamescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Username. != "" {
175 username = c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..Usernamescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Username.
176 }
177
178 c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg. = fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("n=%s,r=%s", username, clientNonce)
179 msg := fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().(
180 `{"protocol_version": %d,"authentication": "n,,%s","authentication_method": "%s"}`,
181 handshakeV1_0_protocolVersionNumberscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_protocolVersionNumber., c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg., handshakeV1_0_authenticationMethodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_authenticationMethod.,
182 )
183
184 pos := 0
185 dataLen := 4 + len(msg) + 1
186 data := make([]byte, dataLen)
187
188 // Send the protocol version to the server as a 4-byte little-endian-encoded integer
189 binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint32().(data[pos:], uint32(pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.VersionDummy_V1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/VersionDummy_V1_0.))
190 pos += 4
191
192 // Send the auth message as an ASCII string
193 pos += copy(data[pos:], msg)
194
195 // Add null terminating byte
196 data[pos] = '\x00'
197
198 return c.writeDatascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeData().(data)
199 }
200
201 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) checkServerVersionsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#checkServerVersions().() error {
202 b, err := c.readResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readResponse().()
203 if err != nil {
204 return err
205 }
206
207 // Read status
208 type versionsResponse struct {
209 Success bool `json:"success"`
210 MinProtocolVersion int `json:"min_protocol_version"`
211 MaxProtocolVersion int `json:"max_protocol_version"`
212 ServerVersion string `json:"server_version"`
213 ErrorCode int `json:"error_code"`
214 Error string `json:"error"`
215 }
216 var rsp *versionsResponse
217 statusStr := string(b)
218
219 if err := jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Unmarshal().(b, &rsp); err != nil {
220 if stringsscip-go gomod github.com/golang/go/src go1.14 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.14 strings/HasPrefix().(statusStr, "ERROR: ") {
221 statusStr = stringsscip-go gomod github.com/golang/go/src go1.14 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.14 strings/TrimPrefix().(statusStr, "ERROR: ")
222 return RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(statusStr)}
223 }
224
225 return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Error reading versions: %s", err))}
226 }
227
228 if !rsp.Success {
229 return c.handshakeErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#handshakeError().(rsp.ErrorCode, rsp.Error)
230 }
231 if rsp.MinProtocolVersion > handshakeV1_0_protocolVersionNumberscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_protocolVersionNumber. ||
232 rsp.MaxProtocolVersion < handshakeV1_0_protocolVersionNumberscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_protocolVersionNumber. {
233 return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(
234 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().(
235 "Unsupported protocol version %d, expected between %d and %d.",
236 handshakeV1_0_protocolVersionNumberscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/handshakeV1_0_protocolVersionNumber.,
237 rsp.MinProtocolVersion,
238 rsp.MaxProtocolVersion,
239 ),
240 )}
241 }
242
243 return nil
244 }
245
246 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) readFirstMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readFirstMessage().() (i int64, salt []byte, serverNonce string, err error) {
247 b, err2 := c.readResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readResponse().()
248 if err2 != nil {
249 err = err2
250 return
251 }
252
253 // Read server message
254 type firstMessageResponse struct {
255 Success bool `json:"success"`
256 Authentication string `json:"authentication"`
257 ErrorCode int `json:"error_code"`
258 Error string `json:"error"`
259 }
260 var rsp *firstMessageResponse
261
262 if err2 := jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Unmarshal().(b, &rsp); err2 != nil {
263 err = RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Error parsing auth response: %s", err2))}
264 return
265 }
266 if !rsp.Success {
267 err = c.handshakeErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#handshakeError().(rsp.ErrorCode, rsp.Error)
268 return
269 }
270
271 c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg. += ","
272 c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg. += rsp.Authentication
273
274 // Parse authentication field
275 auth := map[string]string{}
276 parts := stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Splitscip-go gomod github.com/golang/go/src go1.14 strings/Split().(rsp.Authentication, ",")
277 for _, part := range parts {
278 i := stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Indexscip-go gomod github.com/golang/go/src go1.14 strings/Index().(part, "=")
279 if i != -1 {
280 auth[part[:i]] = part[i+1:]
281 }
282 }
283
284 // Extract return values
285 if v, ok := auth["i"]; ok {
286 i, err = strconvscip-go gomod github.com/golang/go/src go1.14 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.14 strconv/ParseInt().(v, 10, 64)
287 if err != nil {
288 return
289 }
290 }
291 if v, ok := auth["s"]; ok {
292 salt, err = base64scip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/StdEncoding..DecodeStringscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/Encoding#DecodeString().(v)
293 if err != nil {
294 return
295 }
296 }
297 if v, ok := auth["r"]; ok {
298 serverNonce = v
299 }
300
301 return
302 }
303
304 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) writeFinalMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeFinalMessage().(serverNonce, clientProof string) error {
305 authMsg := "c=biws,r="
306 authMsg += serverNonce
307 authMsg += ",p="
308 authMsg += clientProof
309
310 msg := fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().(`{"authentication": "%s"}`, authMsg)
311
312 pos := 0
313 dataLen := len(msg) + 1
314 data := make([]byte, dataLen)
315
316 // Send the auth message as an ASCII string
317 pos += copy(data[pos:], msg)
318
319 // Add null terminating byte
320 data[pos] = '\x00'
321
322 return c.writeDatascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeData().(data)
323 }
324
325 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) readFinalMessagescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readFinalMessage().(serverSignature string) error {
326 b, err := c.readResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readResponse().()
327 if err != nil {
328 return err
329 }
330
331 // Read server message
332 type finalMessageResponse struct {
333 Success bool `json:"success"`
334 Authentication string `json:"authentication"`
335 ErrorCode int `json:"error_code"`
336 Error string `json:"error"`
337 }
338 var rsp *finalMessageResponse
339
340 if err := jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Unmarshal().(b, &rsp); err != nil {
341 return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Error parsing auth response: %s", err))}
342 }
343 if !rsp.Success {
344 return c.handshakeErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#handshakeError().(rsp.ErrorCode, rsp.Error)
345 }
346
347 // Parse authentication field
348 auth := map[string]string{}
349 parts := stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Splitscip-go gomod github.com/golang/go/src go1.14 strings/Split().(rsp.Authentication, ",")
350 for _, part := range parts {
351 i := stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Indexscip-go gomod github.com/golang/go/src go1.14 strings/Index().(part, "=")
352 if i != -1 {
353 auth[part[:i]] = part[i+1:]
354 }
355 }
356
357 // Validate server response
358 if serverSignature != auth["v"] {
359 return RQLAuthErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLAuthError#{RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#("Invalid server signature")}}
360 }
361
362 return nil
363 }
364
365 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) writeDatascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#writeData().(data []byte) error {
366
367 if err := c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..writeDatascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#writeData().(data); err != nil {
368 return RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())}
369 }
370
371 return nil
372 }
373
374 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) readResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#readResponse().() ([]byte, error) {
375 line, err := c.readerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#reader..ReadBytesscip-go gomod github.com/golang/go/src go1.14 bufio/Reader#ReadBytes().('\x00')
376 if err != nil {
377 if err == ioscip-go gomod github.com/golang/go/src go1.14 io/.EOFscip-go gomod github.com/golang/go/src go1.14 io/EOF. {
378 return nil, RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Unexpected EOF: %s", string(line)))}
379 }
380 return nil, RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())}
381 }
382
383 // Strip null byte and return
384 return line[:len(line)-1], nil
385 }
386
387 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) generateNoncescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#generateNonce().() (string, error) {
388 const nonceSize = 24
389
390 b := make([]byte, nonceSize)
391 _, err := randscip-go gomod github.com/golang/go/src go1.14 `crypto/rand`/.Readscip-go gomod github.com/golang/go/src go1.14 `crypto/rand`/Read().(b)
392 if err != nil {
393 return "", err
394 }
395
396 return base64scip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/Encoding#EncodeToString().(b), nil
397 }
398
399 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) saltPasswordscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#saltPassword().(iter int64, salt []byte) []byte {
400 pass := []byte(c.connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#conn..optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..Passwordscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Password.)
401
402 return pbkdf2scip-go gomod golang.org/x/crypto 78000ba7a073 `golang.org/x/crypto/pbkdf2`/.Keyscip-go gomod golang.org/x/crypto 78000ba7a073 `golang.org/x/crypto/pbkdf2`/Key().(pass, salt, int(iter), sha256scip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/.Sizescip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/Size., sha256scip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/.Newscip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/New().)
403 }
404
405 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) calculateProofscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#calculateProof().(saltedPass []byte, clientNonce, serverNonce string) string {
406 // Generate proof
407 c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg. += ",c=biws,r=" + serverNonce
408
409 mac := hmacscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/.Newscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/New().(c.hashFuncscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#hashFunc().(), saltedPass)
410 mac.Writescip-go gomod github.com/golang/go/src go1.14 io/Writer#Write().([]byte("Client Key"))
411 clientKey := mac.Sumscip-go gomod github.com/golang/go/src go1.14 hash/Hash#Sum().(nil)
412
413 hash := c.hashFuncscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#hashFunc().()()
414 hash.Writescip-go gomod github.com/golang/go/src go1.14 io/Writer#Write().(clientKey)
415 storedKey := hash.Sumscip-go gomod github.com/golang/go/src go1.14 hash/Hash#Sum().(nil)
416
417 mac = hmacscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/.Newscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/New().(c.hashFuncscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#hashFunc().(), storedKey)
418 mac.Writescip-go gomod github.com/golang/go/src go1.14 io/Writer#Write().([]byte(c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg.))
419 clientSignature := mac.Sumscip-go gomod github.com/golang/go/src go1.14 hash/Hash#Sum().(nil)
420 clientProof := make([]byte, len(clientKey))
421 for i, _ := range clientKey {
422 clientProof[i] = clientKey[i] ^ clientSignature[i]
423 }
424
425 return base64scip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/Encoding#EncodeToString().(clientProof)
426 }
427
428 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) serverSignaturescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#serverSignature().(saltedPass []byte) string {
429 mac := hmacscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/.Newscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/New().(c.hashFuncscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#hashFunc().(), saltedPass)
430 mac.Writescip-go gomod github.com/golang/go/src go1.14 io/Writer#Write().([]byte("Server Key"))
431 serverKey := mac.Sumscip-go gomod github.com/golang/go/src go1.14 hash/Hash#Sum().(nil)
432
433 mac = hmacscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/.Newscip-go gomod github.com/golang/go/src go1.14 `crypto/hmac`/New().(c.hashFuncscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#hashFunc().(), serverKey)
434 mac.Writescip-go gomod github.com/golang/go/src go1.14 io/Writer#Write().([]byte(c.authMsgscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#authMsg.))
435 serverSignature := mac.Sumscip-go gomod github.com/golang/go/src go1.14 hash/Hash#Sum().(nil)
436
437 return base64scip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src go1.14 `encoding/base64`/Encoding#EncodeToString().(serverSignature)
438 }
439
440 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) handshakeErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#handshakeError().(code int, message string) error {
441 if code >= 10 || code <= 20 {
442 return RQLAuthErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLAuthError#{RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(message)}}
443 }
444
445 return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(message)}
446 }
447
448 func (c *connectionHandshakeV1_0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#) hashFuncscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshakeV1_0#hashFunc().() func() hashscip-go gomod github.com/golang/go/src go1.14 hash/.Hashscip-go gomod github.com/golang/go/src go1.14 hash/Hash# {
449 return sha256scip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/.Newscip-go gomod github.com/golang/go/src go1.14 `crypto/sha256`/New().
450 }