*Add dns api
This commit is contained in:
parent
ce5e713f6a
commit
14cfb55f85
83
src/index.ts
83
src/index.ts
|
@ -29,45 +29,7 @@ export interface StreamFileResponse {
|
||||||
done: boolean;
|
done: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PluginAPI {
|
export type DnsProvider = (ipAddress: string) => Promise<void>;
|
||||||
config: any;
|
|
||||||
registerMethod: (methodName: string, method: RPCMethod) => void;
|
|
||||||
loadPlugin: (moduleName: string) => Promise<Plugin>;
|
|
||||||
getMethods: () => string[];
|
|
||||||
ssl: {
|
|
||||||
setContext: (context: tls.SecureContext) => void;
|
|
||||||
getContext: () => tls.SecureContext;
|
|
||||||
getSaved: (retry: boolean) => Promise<boolean | SavedSslData>;
|
|
||||||
set: (
|
|
||||||
cert: IndependentFileSmall | Uint8Array,
|
|
||||||
key: IndependentFileSmall | Uint8Array
|
|
||||||
) => void;
|
|
||||||
get: () => SslData;
|
|
||||||
save: () => Promise<void>;
|
|
||||||
};
|
|
||||||
appRouter: {
|
|
||||||
get: () => express.Router;
|
|
||||||
set: (newRouter: express.Router) => void;
|
|
||||||
reset: () => void;
|
|
||||||
};
|
|
||||||
files: {
|
|
||||||
createIndependentFileSmall(
|
|
||||||
seed: Uint8Array,
|
|
||||||
userInode: string,
|
|
||||||
fileData: Uint8Array
|
|
||||||
): Promise<[IndependentFileSmall, Err]>;
|
|
||||||
openIndependentFileSmall(
|
|
||||||
seed: Uint8Array,
|
|
||||||
userInode: string
|
|
||||||
): Promise<[IndependentFileSmall, Err]>;
|
|
||||||
overwriteIndependentFileSmall(
|
|
||||||
file: IndependentFileSmall,
|
|
||||||
newData: Uint8Array
|
|
||||||
): Promise<Err>;
|
|
||||||
};
|
|
||||||
logger: Logger;
|
|
||||||
getSeed: () => Uint8Array;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type PluginFunction = (api: PluginAPI) => Promise<void>;
|
export type PluginFunction = (api: PluginAPI) => Promise<void>;
|
||||||
|
|
||||||
|
@ -116,3 +78,46 @@ export interface SavedSslData {
|
||||||
cert?: IndependentFileSmall;
|
cert?: IndependentFileSmall;
|
||||||
key?: IndependentFileSmall;
|
key?: IndependentFileSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PluginAPI {
|
||||||
|
config: any;
|
||||||
|
registerMethod: (methodName: string, method: RPCMethod) => void;
|
||||||
|
loadPlugin: (moduleName: string) => Promise<Plugin>;
|
||||||
|
getMethods: () => string[];
|
||||||
|
ssl: {
|
||||||
|
setContext: (context: tls.SecureContext) => void;
|
||||||
|
getContext: () => tls.SecureContext;
|
||||||
|
getSaved: (retry: boolean) => Promise<boolean | SavedSslData>;
|
||||||
|
set: (
|
||||||
|
cert: IndependentFileSmall | Uint8Array,
|
||||||
|
key: IndependentFileSmall | Uint8Array
|
||||||
|
) => void;
|
||||||
|
get: () => SslData;
|
||||||
|
save: () => Promise<void>;
|
||||||
|
};
|
||||||
|
appRouter: {
|
||||||
|
get: () => express.Router;
|
||||||
|
set: (newRouter: express.Router) => void;
|
||||||
|
reset: () => void;
|
||||||
|
};
|
||||||
|
files: {
|
||||||
|
createIndependentFileSmall(
|
||||||
|
seed: Uint8Array,
|
||||||
|
userInode: string,
|
||||||
|
fileData: Uint8Array
|
||||||
|
): Promise<[IndependentFileSmall, Err]>;
|
||||||
|
openIndependentFileSmall(
|
||||||
|
seed: Uint8Array,
|
||||||
|
userInode: string
|
||||||
|
): Promise<[IndependentFileSmall, Err]>;
|
||||||
|
overwriteIndependentFileSmall(
|
||||||
|
file: IndependentFileSmall,
|
||||||
|
newData: Uint8Array
|
||||||
|
): Promise<Err>;
|
||||||
|
};
|
||||||
|
dns: {
|
||||||
|
setProvider(provider: DnsProvider): void;
|
||||||
|
};
|
||||||
|
logger: Logger;
|
||||||
|
getSeed: () => Uint8Array;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue