Figure out node ip

This commit is contained in:
maciejhirsz
2018-07-06 19:12:24 +02:00
parent 538a30ccc3
commit 3259bc67a3
7 changed files with 53 additions and 11 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
import * as WebSocket from 'ws';
import * as EventEmitter from 'events';
import * as iplocation from 'iplocation';
import { timestamp, Maybe, Types, idGenerator } from '@dotstats/common';
import { parseMessage, getBestBlock, Message, BestBlock, SystemInterval } from './message';
@@ -83,7 +84,9 @@ export default class Node {
});
}
public static fromSocket(socket: WebSocket): Promise<Node> {
public static fromSocket(socket: WebSocket, ip: string): Promise<Node> {
console.log('node ip', ip);
return new Promise((resolve, reject) => {
function cleanup() {
clearTimeout(timeout);