netaddress: minor.
This commit is contained in:
parent
546fccfca8
commit
9fd7153100
@ -189,8 +189,11 @@ NetworkAddress.fromHost = function fromHost(host, port, network) {
|
|||||||
|
|
||||||
NetworkAddress.prototype.fromHostname = function fromHostname(hostname, network) {
|
NetworkAddress.prototype.fromHostname = function fromHostname(hostname, network) {
|
||||||
var addr;
|
var addr;
|
||||||
|
|
||||||
network = Network.get(network);
|
network = Network.get(network);
|
||||||
|
|
||||||
addr = IP.parseHost(hostname, network.port);
|
addr = IP.parseHost(hostname, network.port);
|
||||||
|
|
||||||
return this.fromHost(addr.host, addr.port, network);
|
return this.fromHost(addr.host, addr.port, network);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -239,14 +242,11 @@ NetworkAddress.fromSocket = function fromSocket(hostname, network) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
NetworkAddress.prototype.fromReader = function fromReader(br, full) {
|
NetworkAddress.prototype.fromReader = function fromReader(br, full) {
|
||||||
// only version >= 31402
|
|
||||||
this.ts = full ? br.readU32() : 0;
|
this.ts = full ? br.readU32() : 0;
|
||||||
this.services = br.readU53();
|
this.services = br.readU53();
|
||||||
this.host = IP.toString(br.readBytes(16));
|
this.host = IP.toString(br.readBytes(16, true));
|
||||||
this.port = br.readU16BE();
|
this.port = br.readU16BE();
|
||||||
|
|
||||||
this.hostname = IP.hostname(this.host, this.port);
|
this.hostname = IP.hostname(this.host, this.port);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user