25 lines
602 B
JavaScript
25 lines
602 B
JavaScript
var ClientConstants = require('../constants/client');
|
|
var Packet = require('../packets/packet');
|
|
var Charsets = require('../constants/charsets');
|
|
|
|
function SSLRequest(flags)
|
|
{
|
|
this.clientFlags = flags | ClientConstants.SSL;
|
|
}
|
|
|
|
SSLRequest.prototype.toPacket = function()
|
|
{
|
|
var length = 36;
|
|
var buffer = new Buffer(36);
|
|
var packet = new Packet(0, buffer);
|
|
buffer.fill(0);
|
|
packet.offset = 4;
|
|
|
|
packet.writeInt32(this.clientFlags);
|
|
packet.writeInt32(0); // max packet size. todo: move to config
|
|
packet.writeInt8(Charsets.UTF8_GENERAL_CI);
|
|
return packet;
|
|
};
|
|
|
|
module.exports = SSLRequest;
|