mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 16:54:08 +00:00
Broadcast peer info over floodsub when requested (#332)
* Refactor discovery handler * Broadcast peer info over floodsub on requests * Broadcast peer info from relay nodes * Make debug reponse handler optional * Register debug info request handler on peer init * Move debug info types to types dir * Return method to unsubscribe from the debug topic * Make debug info flag optional for relay nodes * Restructure peer connection info data * Refactor getting peer info to be used in react app * Refactor duplicate code to utils * Rename peer methods --------- Co-authored-by: nabarun <nabarun@deepstacksoft.com>
This commit is contained in:
@@ -23,6 +23,7 @@ interface Arguments {
|
||||
dialTimeout: number;
|
||||
maxRelayConnections: number;
|
||||
peerIdFile: string;
|
||||
enableDebugInfo: boolean;
|
||||
}
|
||||
|
||||
export class PeerCmd {
|
||||
@@ -40,7 +41,8 @@ export class PeerCmd {
|
||||
const peerNodeInit: PeerInitConfig = {
|
||||
maxConnections: argv.maxConnections,
|
||||
dialTimeout: argv.dialTimeout,
|
||||
maxRelayConnections: argv.maxRelayConnections
|
||||
maxRelayConnections: argv.maxRelayConnections,
|
||||
enableDebugInfo: argv.enableDebugInfo
|
||||
};
|
||||
|
||||
await peer.init(peerNodeInit, peerIdObj);
|
||||
@@ -87,6 +89,11 @@ function _getArgv (): any {
|
||||
type: 'string',
|
||||
alias: 'f',
|
||||
describe: 'Peer id file path (json)'
|
||||
},
|
||||
enableDebugInfo: {
|
||||
type: 'boolean',
|
||||
describe: 'Whether to participate in exchanging debug info over floodsub',
|
||||
default: false
|
||||
}
|
||||
}).argv;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,8 @@ export class ServerCmd {
|
||||
pingInterval: relayConfig.pingInterval ?? DEFAULT_PING_INTERVAL,
|
||||
redialInterval: relayConfig.redialInterval ?? RELAY_REDIAL_INTERVAL,
|
||||
maxDialRetry: relayConfig.maxDialRetry ?? RELAY_DEFAULT_MAX_DIAL_RETRY,
|
||||
peerIdObj
|
||||
peerIdObj,
|
||||
enableDebugInfo: relayConfig.enableDebugInfo
|
||||
};
|
||||
await createRelayNode(relayNodeInit);
|
||||
}
|
||||
@@ -200,7 +201,8 @@ export class ServerCmd {
|
||||
maxRelayConnections: peerConfig.maxRelayConnections,
|
||||
relayRedialInterval: peerConfig.relayRedialInterval,
|
||||
maxConnections: peerConfig.maxConnections,
|
||||
dialTimeout: peerConfig.dialTimeout
|
||||
dialTimeout: peerConfig.dialTimeout,
|
||||
enableDebugInfo: peerConfig.enableDebugInfo
|
||||
};
|
||||
await peer.init(peerNodeInit, peerIdObj);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user