Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server.on('connection', conn => {
console.log('connection');
conn.serverHandshake({
protocolVersion: 10,
serverVersion: 'node.js rocks',
connectionId: 1234,
statusFlags: 2,
characterSet: 8,
capabilityFlags: 0xffffff ^ ClientFlags.COMPRESS
});
conn.on('field_list', (table, fields) => {
console.log('field list:', table, fields);
conn.writeEof();
});
const remote = mysql.createConnection({
user: 'root',
database: 'dbname',
host: 'server.example.com',
password: 'secret'
});
conn.on('query', sql => {
console.log(`proxying query: ${sql}`);
server.on('connection', (connection) => {
debug('received client connection request');
connection.serverHandshake({
capabilityFlags: 0xffffff ^ ClientFlags.COMPRESS,
characterSet: 8,
connectionId: connectionId++,
protocolVersion: 10,
serverVersion: '5.6.10',
statusFlags: 2
});
const remote = mysql.createConnection(createDatabaseConnectionConfiguration(argv));
connection.on('error', (error) => {
debug('connection error', error.message);
});
connection.on('field_list', (targetTable, fields) => {
debug('field_list', targetTable, fields);