From db3b913740b97807247c1e444260e1b1c6d473b6 Mon Sep 17 00:00:00 2001 From: Brian Botha Date: Tue, 29 Mar 2022 15:09:39 +1100 Subject: [PATCH] fix: proxyConfig options and defaults Fixed up `PolykeyAgent`'s proxyConfig to align with the `Proxy`'s parameters. Updated config defaults to align as well. Fixed up failing test in `certchain.test.st` as well. --- src/PolykeyAgent.ts | 6 ++++-- src/bin/agent/CommandStart.ts | 4 ++-- src/bin/utils/options.ts | 6 +++--- src/config.ts | 6 ++++-- tests/bin/keys/certchain.test.ts | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/PolykeyAgent.ts b/src/PolykeyAgent.ts index c01027a79..ba9cafc37 100644 --- a/src/PolykeyAgent.ts +++ b/src/PolykeyAgent.ts @@ -103,8 +103,10 @@ class PolykeyAgent { proxyConfig?: { authToken?: string; connConnectTime?: number; - connTimeoutTime?: number; - connPingIntervalTime?: number; + connKeepAliveTimeoutTime?: number; + connEndTime?: number; + connPunchIntervalTime?: number; + connKeepAliveIntervalTime?: number; }; nodeConnectionManagerConfig?: { connConnectTime?: number; diff --git a/src/bin/agent/CommandStart.ts b/src/bin/agent/CommandStart.ts index 86dfd726c..d99a60369 100644 --- a/src/bin/agent/CommandStart.ts +++ b/src/bin/agent/CommandStart.ts @@ -29,7 +29,7 @@ class CommandStart extends CommandPolykey { this.addOption(binOptions.clientPort); this.addOption(binOptions.proxyHost); this.addOption(binOptions.proxyPort); - this.addOption(binOptions.connTimeoutTime); + this.addOption(binOptions.connConnectTime); this.addOption(binOptions.seedNodes); this.addOption(binOptions.network); this.addOption(binOptions.workers); @@ -96,7 +96,7 @@ class CommandStart extends CommandPolykey { recoveryCode: recoveryCodeIn, }, proxyConfig: { - connTimeoutTime: options.connTimeoutTime, + connConnectTime: options.connectionTimeout, }, networkConfig: { clientHost: options.clientHost, diff --git a/src/bin/utils/options.ts b/src/bin/utils/options.ts index 60ea5ac0a..bed18d65a 100644 --- a/src/bin/utils/options.ts +++ b/src/bin/utils/options.ts @@ -84,12 +84,12 @@ const proxyPort = new commander.Option('-pp, --proxy-port ', 'Proxy Port') .argParser(binParsers.parsePort) .default(config.defaults.networkConfig.proxyPort); -const connTimeoutTime = new commander.Option( +const connConnectTime = new commander.Option( '--connection-timeout ', 'Timeout value for connection establishment between nodes', ) .argParser(binParsers.parseInteger) - .default(config.defaults.proxyConfig.connTimeoutTime); + .default(config.defaults.proxyConfig.connConnectTime); const passwordFile = new commander.Option( '-pf, --password-file ', @@ -164,7 +164,7 @@ export { clientPort, proxyHost, proxyPort, - connTimeoutTime, + connConnectTime, recoveryCodeFile, passwordFile, passwordNewFile, diff --git a/src/config.ts b/src/config.ts index 7e9b732bd..752b3b497 100644 --- a/src/config.ts +++ b/src/config.ts @@ -84,8 +84,10 @@ const config = { }, proxyConfig: { connConnectTime: 20000, - connTimeoutTime: 20000, - connPingIntervalTime: 1000, + connKeepAliveTimeoutTime: 20000, + connEndTime: 1000, + connPunchIntervalTime: 1000, + connKeepAliveIntervalTime: 1000, }, nodeConnectionManagerConfig: { connConnectTime: 20000, diff --git a/tests/bin/keys/certchain.test.ts b/tests/bin/keys/certchain.test.ts index 1391b997d..e01de8896 100644 --- a/tests/bin/keys/certchain.test.ts +++ b/tests/bin/keys/certchain.test.ts @@ -40,6 +40,6 @@ describe('certchain', () => { )); expect(exitCode).toBe(0); const certChainStatus = JSON.parse(stdout).rootCertChainPem; - expect(certChainCommand).toBe(certChainStatus); + expect(certChainCommand.rootPublicKeyPem).toBe(certChainStatus); }); });