Ping / circuit latency, break out commands, add typing function for IM, add thinkingTime and charactersPerSecond parameters to typing functions
This commit is contained in:
@@ -10,25 +10,39 @@ export class IPAddress
|
||||
}
|
||||
public toString = (): string =>
|
||||
{
|
||||
return this.ip.toString();
|
||||
try
|
||||
{
|
||||
return this.ip.toString();
|
||||
}
|
||||
catch (ignore)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
};
|
||||
constructor(buf?: Buffer | string, pos?: number)
|
||||
{
|
||||
if (buf !== undefined && buf instanceof Buffer)
|
||||
try
|
||||
{
|
||||
if (pos !== undefined)
|
||||
if (buf !== undefined && buf instanceof Buffer)
|
||||
{
|
||||
const bytes = buf.slice(pos, 4);
|
||||
this.ip = ipaddr.fromByteArray(bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ipaddr.isValid(buf))
|
||||
if (pos !== undefined)
|
||||
{
|
||||
this.ip = ipaddr.parse(buf);
|
||||
const bytes = buf.slice(pos, 4);
|
||||
this.ip = ipaddr.fromByteArray(bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ipaddr.isValid(buf))
|
||||
{
|
||||
this.ip = ipaddr.parse(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ignore)
|
||||
{
|
||||
this.ip = ipaddr.parse('0.0.0.0');
|
||||
}
|
||||
}
|
||||
writeToBuffer(buf: Buffer, pos: number)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user