Compare commits

..

No commits in common. "19ad44b0666fa3dac0ce455d5cf095e8ae14fc6f" and "a9f3348a01d2cda347ab7ea1a082e66d7c196bfb" have entirely different histories.

2 changed files with 7 additions and 7 deletions

View File

@ -17,29 +17,29 @@ const LogLevels = {
let logLevel = LogLevels.error; let logLevel = LogLevels.error;
function timestamp() { function timestamp() {
const d = new Date().toISOString(); const d = new Date().toISOString();
return [d.slice(5, 5), d.slice(11, 8)].join(' ') return [d.substr(5, 5), d.substr(11, 8)].join(' ')
} }
class Logger { class Logger {
debug(...args) { debug(...args) {
if (LogLevels.debug > logLevel) return; if (LogLevels.debug > logLevel) return;
const [format, ...rest] = args; const [format, ...rest] = args;
console.error(timestamp(), "D", util.format(format, ...rest)); console.debug(timestamp(), "D", util.format(format, ...rest));
} }
info(...args) { info(...args) {
if (LogLevels.info > logLevel) return; if (LogLevels.info > logLevel) return;
const [format, ...rest] = args; const [format, ...rest] = args;
console.error(timestamp(), "I", util.format(format, ...rest)); console.debug(timestamp(), "I", util.format(format, ...rest));
} }
warn(...args) { warn(...args) {
if (LogLevels.warn > logLevel) return; if (LogLevels.warn > logLevel) return;
const [format, ...rest] = args; const [format, ...rest] = args;
console.error(timestamp(), "W", util.format(format, ...rest)); console.debug(timestamp(), "W", util.format(format, ...rest));
} }
error(...args) { error(...args) {
if (LogLevels.error > logLevel) return; if (LogLevels.error > logLevel) return;
const [format, ...rest] = args; const [format, ...rest] = args;
console.error(timestamp(), "E", util.format(format, ...rest)); console.debug(timestamp(), "E", util.format(format, ...rest));
} }
} }
@ -139,7 +139,7 @@ class Logger {
/** @type TorStream */ /** @type TorStream */
let tor_stream; let tor_stream;
if (uri.hostname.endsWith('.onion')) { if (uri.hostname.endsWith('.onion')) {
const onion = uri.hostname.slice(0, uri.hostname.length - 6); const onion = uri.hostname.substr(0, uri.hostname.length - 6);
tor_stream = await circuit.create_onion_stream(onion, uri.port); tor_stream = await circuit.create_onion_stream(onion, uri.port);
} else { } else {
tor_stream = await circuit.create_stream(uri.hostname, uri.port); tor_stream = await circuit.create_stream(uri.hostname, uri.port);

View File

@ -2,7 +2,7 @@ const crypto = require('crypto')
const dh1024 = require('../utils/dh1024') const dh1024 = require('../utils/dh1024')
const {sha1} = require('../utils/crypto') const {sha1} = require('../utils/crypto')
const DH_P = Buffer.from([ const DH_P = new Buffer([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34,
0xc4, 0xc6, 0x62, 0x8b, 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, 0xcc, 0x74, 0xc4, 0xc6, 0x62, 0x8b, 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, 0xcc, 0x74,
0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd, 0x02, 0x0b, 0xbe, 0xa6, 0x3b, 0x13, 0x9b, 0x22, 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd,