*Add remotePublicKey to socket class

This commit is contained in:
Derrick Hammer 2023-02-24 20:04:30 -05:00
parent 3ce2313c5a
commit 108e1b3dd8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,7 @@ interface SocketOptions {
allowHalfOpen?: boolean; allowHalfOpen?: boolean;
remoteAddress?: string; remoteAddress?: string;
remotePort?: number; remotePort?: number;
remotePublicKey?: Uint8Array;
write?: ( write?: (
this: Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>, this: Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>,
data: any, data: any,
@ -26,17 +27,20 @@ export default class Socket extends Duplex {
declare readable: true; declare readable: true;
declare writable: true; declare writable: true;
public remotePublicKey: Uint8Array;
constructor({ constructor({
allowHalfOpen = false, allowHalfOpen = false,
remoteAddress, remoteAddress,
remotePort, remotePort,
remotePublicKey,
write, write,
}: SocketOptions = {}) { }: SocketOptions = {}) {
super({ write }); super({ write });
this._allowHalfOpen = allowHalfOpen; this._allowHalfOpen = allowHalfOpen;
this.remoteAddress = remoteAddress; this.remoteAddress = remoteAddress;
this.remotePort = remotePort; this.remotePort = remotePort;
this.remotePublicKey = remotePublicKey;
if (remoteAddress) { if (remoteAddress) {
const type = Socket.isIP(remoteAddress); const type = Socket.isIP(remoteAddress);