@@ -73,10 +73,9 @@ const config = {
7373 } ,
7474 } ,
7575 /**
76- * Default configuration
76+ * File/directory paths
7777 */
78- defaults : {
79- nodePath : getDefaultNodePath ( ) ,
78+ paths : {
8079 statusBase : 'status.json' ,
8180 statusLockBase : 'status.lock' ,
8281 stateBase : 'state' ,
@@ -86,73 +85,116 @@ const config = {
8685 vaultsBase : 'vaults' ,
8786 efsBase : 'efs' ,
8887 tokenBase : 'token' ,
89- certManagerConfig : {
90- certDuration : 31536000 ,
91- } ,
92- networkConfig : {
93- /**
94- * Agent host defaults to `::` dual stack.
95- * This is because the agent service is supposed to be public.
96- */
97- agentHost : '::' ,
98- agentPort : 0 ,
99- /**
100- * Client host defaults to `localhost`.
101- * This will depend on the OS configuration.
102- * Usually it will be IPv4 `127.0.0.1` or IPv6 `::1`.
103- * This is because the client service is private most of the time.
104- */
105- clientHost : 'localhost' ,
106- clientPort : 0 ,
107- /**
108- * If using dual stack `::`, then this forces only IPv6 bindings.
109- */
110- ipv6Only : false ,
111-
112- /**
113- * Agent service transport keep alive interval time.
114- * This the maxmum time between keep alive messages.
115- * This only has effect if `agentMaxIdleTimeout` is greater than 0.
116- * See the transport layer for further details.
117- */
118- agentKeepAliveIntervalTime : 10_000 , // 10 seconds
119-
120- /**
121- * Agent service transport max idle timeout.
122- * This is the maximum time that a connection can be idle.
123- * This also controls how long the transport layer will dial
124- * for a client connection.
125- * See the transport layer for further details.
126- */
127- agentMaxIdleTimeout : 60_000 , // 1 minute
128-
129- clientMaxIdleTimeout : 120 , // 2 minutes
130- clientPingIntervalTime : 1_000 , // 1 second
131- clientPingTimeoutTimeTime : 10_000 , // 10 seconds
132-
133- /**
134- * Controls the stream parser buffer limit.
135- * This is the maximum number of bytes that the stream parser
136- * will buffer before rejecting the RPC call.
137- */
138- clientParserBufferByteLimit : 1_000_000 , // About 1MB
139- clientHandlerTimeoutTime : 60_000 , // 1 minute
140- clientHandlerTimeoutGraceTime : 2_000 , // 2 seconds
141- } ,
142- nodeConnectionManagerConfig : {
143- connectionConnectTime : 2000 ,
144- connectionTimeoutTime : 60000 ,
145- initialClosestNodes : 3 ,
146- pingTimeoutTime : 2000 ,
147- connectionHolePunchTimeoutTime : 4000 ,
148- connectionHolePunchIntervalTime : 250 ,
149- } ,
150- // This is not used by the `PolykeyAgent` which defaults to `{}`
151- network : {
152- mainnet : mainnet ,
153- testnet : testnet ,
154- } ,
88+ } ,
89+ /**
90+ * This is not used by the `PolykeyAgent` which defaults to `{}`
91+ * In the future this will be replaced by `mainnet.polykey.com` and `testnet.polykey.com`.
92+ * Along with the domain we will have the root public key too.
93+ *
94+ * Information that is pre-configured during distribution:
95+ *
96+ * - Domain
97+ * - Root public key
98+ *
99+ * Information that is discovered over DNS (Authenticated DNS is optional):
100+ *
101+ * - IP address
102+ * - Port
103+ *
104+ * As long as the root public key is provided, it is sufficient to defeat poisoning
105+ * the network. The root public key should also be changed often to reduce the impact
106+ * of compromises. Finally the root public key can also be signed by a third party CA
107+ * providing an extra level of confidence. However this is not required.
108+ */
109+ network : {
110+ mainnet : mainnet ,
111+ testnet : testnet ,
112+ } ,
113+ /**
114+ * Default system configuration.
115+ * These are not meant to be changed by the user.
116+ * These constants are tuned for optimal operation by the developers.
117+ */
118+ defaultSystem : {
119+ /**
120+ * Controls the stream parser buffer limit.
121+ * This is the maximum number of bytes that the stream parser
122+ * will buffer before rejecting the RPC call.
123+ */
124+ rpcParserBufferByteLimit : 1_000_000 , // About 1MB
125+ rpcHandlerTimeoutTime : 60_000 , // 1 minute
126+ rpcHandlerTimeoutGraceTime : 2_000 , // 2 seconds
127+
128+ nodesInitialClosestNodes : 3 ,
129+
130+ nodesConnectionConnectTime : 2000 ,
131+ nodesConnectionTimeoutTime : 60000 ,
132+
133+ nodesConnectionHolePunchTimeoutTime : 4000 ,
134+ nodesConnectionHolePunchIntervalTime : 250 ,
135+
136+ nodesPingTimeoutTime : 2000 ,
137+
138+ clientTransportMaxIdleTimeoutTime : 120 , // 2 minutes
139+ clientTransportPingIntervalTime : 1_000 , // 1 second
140+ clientTransportPingTimeoutTime : 10_000 , // 10 seconds
141+
142+ /**
143+ * Agent service transport keep alive interval time.
144+ * This the maxmum time between keep alive messages.
145+ * This only has effect if `agentMaxIdleTimeout` is greater than 0.
146+ * See the transport layer for further details.
147+ */
148+ agentConnectionKeepAliveIntervalTime : 10_000 , // 10 seconds
149+ /**
150+ * Agent service transport max idle timeout.
151+ * This is the maximum time that a connection can be idle.
152+ * This also controls how long the transport layer will dial
153+ * for a client connection.
154+ * See the transport layer for further details.
155+ */
156+ agentConnectionMaxIdleTimeoutTime : 60_000 , // 1 minute
157+
158+
159+
160+
161+ // Why are these done separately?
162+ // Shouldn't we have a consistent time from NCM down to agent connection?
163+
164+ // Transport layer is sort should be controlled separately?
165+
166+ } ,
167+ /**
168+ * Default user configuration.
169+ * These are meant to be changed by the user.
170+ * However the defaults here provide the average user experience.
171+ */
172+ defaultsUser : {
173+ nodePath : getDefaultNodePath ( ) ,
174+ rootCertDuration : 31536000 ,
175+ /**
176+ * If using dual stack `::`, then this forces only IPv6 bindings.
177+ */
178+ ipv6Only : false ,
179+ /**
180+ * Agent host defaults to `::` dual stack.
181+ * This is because the agent service is supposed to be public.
182+ */
183+ agentServiceHost : '::' ,
184+ agentServicePort : 0 ,
185+ /**
186+ * Client host defaults to `localhost`.
187+ * This will depend on the OS configuration.
188+ * Usually it will be IPv4 `127.0.0.1` or IPv6 `::1`.
189+ * This is because the client service is private most of the time.
190+ */
191+ clientServiceHost : 'localhost' ,
192+ clientServicePort : 0 ,
155193 } ,
156194} ;
157195
196+ type Config = typeof config ;
197+
158198export default config ;
199+
200+ export type { Config } ;
0 commit comments