coin-hive-stratum
Advanced tools
Comparing version 2.1.4 to 2.2.1
@@ -49,3 +49,3 @@ "use strict"; | ||
} | ||
Proxy.prototype.listen = function (port) { | ||
Proxy.prototype.listen = function (port, host, callback) { | ||
var _this = this; | ||
@@ -117,3 +117,14 @@ // create server | ||
}); | ||
this.server.listen(port); | ||
if (!host && !callback) { | ||
this.server.listen(port); | ||
} | ||
else if (!host && callback) { | ||
this.server.listen(port, callback); | ||
} | ||
else if (host && !callback) { | ||
this.server.listen(port, host); | ||
} | ||
else { | ||
this.server.listen(port, host, callback); | ||
} | ||
console.log("listening on port " + port + (isHTTPS ? ", using a secure connection" : "")); | ||
@@ -156,2 +167,5 @@ if (wssOptions.path) { | ||
}; | ||
Proxy.prototype.isEmpty = function (connection) { | ||
return connection.miners.length === 0 && connection.donations.length === 0; | ||
}; | ||
Proxy.prototype.getStats = function () { | ||
@@ -185,3 +199,3 @@ var _this = this; | ||
var connections = _this.connections[connectionId]; | ||
var availableConnection = connections.filter(function (connection) { return _this.isAvailable(connection); }); | ||
var availableConnection = connections.filter(function (connection) { return _this.isEmpty(connection); }); | ||
var unusedConnections = availableConnection.slice(1); | ||
@@ -188,0 +202,0 @@ unusedConnections.forEach(function (unusedConnection) { |
{ | ||
"name": "coin-hive-stratum", | ||
"version": "2.1.4", | ||
"version": "2.2.1", | ||
"description": "proxy to use CoinHive miner on any stratum pool", | ||
@@ -5,0 +5,0 @@ "main": "build", |
@@ -69,3 +69,3 @@ import * as WebSocket from "ws"; | ||
listen(port: number): void { | ||
listen(port: number, host?: string, callback?: () => void): void { | ||
// create server | ||
@@ -136,3 +136,11 @@ const isHTTPS = !!(this.key && this.cert); | ||
}); | ||
this.server.listen(port); | ||
if (!host && !callback) { | ||
this.server.listen(port); | ||
} else if (!host && callback) { | ||
this.server.listen(port, callback); | ||
} else if (host && !callback) { | ||
this.server.listen(port, host); | ||
} else { | ||
this.server.listen(port, host, callback); | ||
} | ||
console.log(`listening on port ${port}` + (isHTTPS ? ", using a secure connection" : "")); | ||
@@ -139,0 +147,0 @@ if (wssOptions.path) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73312
1910