in pyignite/connection/handshake.py [0:0]
def __create_handshake_data(self):
version = self.protocol_context.version
handshake_data = {
'length': 8,
'op_code': OP_HANDSHAKE,
'version_major': version[0],
'version_minor': version[1],
'version_patch': version[2],
'client_code': 2, # fixed value defined by protocol
}
if self.protocol_context.is_feature_flags_supported():
features = bytes(self.protocol_context.features)
handshake_data['features'] = features
handshake_data['length'] += 5 + len(features)
if self.username and self.password:
handshake_data.update({
'username': self.username,
'password': self.password,
})
handshake_data['length'] += sum([
10, # each `String` header takes 5 bytes
len(self.username),
len(self.password),
])
return handshake_data