Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer 10d3c1fde8
*Update dist 2023-02-24 20:04:45 -05:00
Derrick Hammer 108e1b3dd8
*Add remotePublicKey to socket class 2023-02-24 20:04:30 -05:00
3 changed files with 10 additions and 2 deletions

4
dist/socket.d.ts vendored
View File

@ -4,6 +4,7 @@ interface SocketOptions {
allowHalfOpen?: boolean;
remoteAddress?: string;
remotePort?: number;
remotePublicKey?: Uint8Array;
write?: (this: Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>, data: any, cb: Callback) => void;
}
export default class Socket extends Duplex {
@ -14,7 +15,8 @@ export default class Socket extends Duplex {
bufferSize: any;
readable: true;
writable: true;
constructor({ allowHalfOpen, remoteAddress, remotePort, write, }?: SocketOptions);
remotePublicKey: Uint8Array;
constructor({ allowHalfOpen, remoteAddress, remotePort, remotePublicKey, write, }?: SocketOptions);
private _connecting;
get connecting(): boolean;
get readyState(): string;

4
dist/socket.js vendored
View File

@ -9,11 +9,13 @@ class Socket extends streamx_1.Duplex {
remotePort;
remoteFamily;
bufferSize;
constructor({ allowHalfOpen = false, remoteAddress, remotePort, write, } = {}) {
remotePublicKey;
constructor({ allowHalfOpen = false, remoteAddress, remotePort, remotePublicKey, write, } = {}) {
super({ write });
this._allowHalfOpen = allowHalfOpen;
this.remoteAddress = remoteAddress;
this.remotePort = remotePort;
this.remotePublicKey = remotePublicKey;
if (remoteAddress) {
const type = Socket.isIP(remoteAddress);
if (!type) {

View File

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