refactor: move S5NodeConfig to types and make network optional

This commit is contained in:
Derrick Hammer 2023-08-31 10:58:10 -04:00
parent bbda50ddfb
commit 6e74ef6d8f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 15 additions and 14 deletions

View File

@ -1,6 +1,6 @@
import { Multihash } from "./multihash.js";
import NodeId from "./nodeId.js";
import { Logger, S5Config, S5Services } from "./types.js";
import { Logger, S5Config, S5NodeConfig, S5Services } from "./types.js";
import Unpacker from "./serialization/unpack.js";
import Packer from "./serialization/pack.js";
import StorageLocation from "./storage.js";
@ -26,18 +26,6 @@ const DEFAULT_LOGGER = {
},
};
export interface S5NodeConfig {
p2p?: {
network: string;
peers?: {
initial?: string[];
};
};
keyPair: KeyPairEd25519;
db: AbstractLevel<Uint8Array, string, Uint8Array>;
logger?: Logger;
}
export class S5Node {
private _nodeConfig: S5NodeConfig;

View File

@ -51,7 +51,7 @@ export interface S5Services {
export interface S5Config {
p2p?: {
network: string;
network?: string;
peers?: {
initial?: string[];
};
@ -62,6 +62,19 @@ export interface S5Config {
cacheDb: AbstractLevel<Uint8Array, string, Uint8Array>;
services: S5Services;
}
export interface S5NodeConfig {
p2p?: {
network?: string;
peers?: {
initial?: string[];
};
};
keyPair: KeyPairEd25519;
db: AbstractLevel<Uint8Array, string, Uint8Array>;
logger?: Logger;
}
export interface SignedMessage {
nodeId: NodeId;
message: Uint8Array;