Add mobymask-v2-watcher with integrated relay and peer functionality (#327)

* Add an option to run relay node with watcher server

* Add a v2 mobymask-watcher

* Add an option to run peer node with watcher server

* Ignore ts error when importing types from peer package

* Rename mobymask v2 watcher

* Parse mobymask libp2p messages

* Refactor and add comments

* Add a note in peer package about nodejs exports

* Update copyright
This commit is contained in:
prathamesh0
2023-02-20 18:09:06 +05:30
committed by GitHub
parent 054600ccc4
commit 6fa3ee28b5
63 changed files with 5377 additions and 19 deletions
+44 -5
View File
@@ -36,6 +36,43 @@ export interface GQLCacheConfig {
timeTravelMaxAge: number;
}
// Relay node config
export interface RelayConfig {
// Host to bind the relay server to
host?: string;
// Port to start listening on
port?: number;
// Domain name to be used in the announce address
announce?: string;
// Relay peer id file path (json)
peerIdFile?: string;
// Relay peer multiaddr(s) list
relayPeers?: string[];
// Max number of dial retries to be attempted to a relay peer
maxDialRetry?: number;
}
// P2P config
export interface P2PConfig {
// Enable relay node
enableRelay: boolean;
relay: RelayConfig;
// Enable peer node
enablePeer: boolean;
// Multiaddr of the primary relay node for this peer
relayMultiaddr: string;
// Pubsub topic to subscribe this peer to
pubSubTopic: string;
}
export interface ServerConfig {
host: string;
port: number;
@@ -63,11 +100,13 @@ export interface ServerConfig {
loadRelationsSequential: boolean;
// GQL cache-control max-age settings (in seconds)
gqlCache: GQLCacheConfig
gqlCache: GQLCacheConfig;
p2p: P2PConfig;
}
export interface UpstreamConfig {
cache: CacheConfig,
cache: CacheConfig;
ethServer: {
gqlApiEndpoint: string;
rpcProviderEndpoint: string;
@@ -88,9 +127,9 @@ export interface MetricsConfig {
export interface Config {
server: ServerConfig;
database: ConnectionOptions;
upstream: UpstreamConfig,
jobQueue: JobQueueConfig,
metrics: MetricsConfig,
upstream: UpstreamConfig;
jobQueue: JobQueueConfig;
metrics: MetricsConfig;
}
export const getConfig = async<ConfigType> (configFile: string): Promise<ConfigType> => {