chore: Add the wrapperData, bound effects, and sdk

This commit is contained in:
BluJ
2023-04-13 14:44:17 -06:00
parent cff86718f8
commit c9a1c45930
11 changed files with 134 additions and 25 deletions

View File

@@ -74,7 +74,6 @@ export class Daemons<Ids extends string | never> {
const daemonsStarted = {} as Record<Ids, Promise<DaemonReturned>>;
const { effects } = this;
const daemons = this.daemons ?? [];
const _config = await effects.getServiceConfig();
for (const daemon of daemons) {
const requiredPromise = Promise.all(
daemon.requires?.map((id) => daemonsStarted[id]) ?? []

View File

@@ -2,7 +2,7 @@ import { Effects } from "../types";
import { LocalBinding } from "./LocalBinding";
export class LocalPort {
constructor(readonly id: string, readonly effects: Effects) {}
constructor(readonly effects: Effects, readonly id: string) {}
async bindLan(internalPort: number) {
const [localAddress, ipAddress] = await this.effects.bindLan({
internalPort,

View File

@@ -9,9 +9,9 @@ export class NetworkBuilder {
private constructor(private effects: Effects) {}
getTorHostName(id: string) {
return new TorHostname(id, this.effects);
return new TorHostname(this.effects, id);
}
getPort(id: string) {
return new LocalPort(id, this.effects);
return new LocalPort(this.effects, id);
}
}

View File

@@ -2,7 +2,10 @@ import { Effects } from "../types";
import { TorBinding } from "./TorBinding";
export class TorHostname {
constructor(readonly id: string, readonly effects: Effects) {}
constructor(readonly effects: Effects, readonly id: string) {}
static of(effects: Effects, id: string) {
return new TorHostname(effects, id);
}
async bindTor(internalPort: number, externalPort: number) {
const address = await this.effects.bindTor({
internalPort,