Compare commits
2 Commits
a9f3348a01
...
19ad44b066
Author | SHA1 | Date | |
---|---|---|---|
19ad44b066 | |||
b048b03cb9 |
12
src/index.js
12
src/index.js
@ -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.substr(5, 5), d.substr(11, 8)].join(' ')
|
return [d.slice(5, 5), d.slice(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.debug(timestamp(), "D", util.format(format, ...rest));
|
console.error(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.debug(timestamp(), "I", util.format(format, ...rest));
|
console.error(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.debug(timestamp(), "W", util.format(format, ...rest));
|
console.error(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.debug(timestamp(), "E", util.format(format, ...rest));
|
console.error(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.substr(0, uri.hostname.length - 6);
|
const onion = uri.hostname.slice(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);
|
||||||
|
@ -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 = new Buffer([
|
const DH_P = Buffer.from([
|
||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user