mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
16 lines
517 B
TypeScript
16 lines
517 B
TypeScript
import { Effects } from "../types";
|
|
import { LocalBinding } from "./LocalBinding";
|
|
|
|
export class LocalPort {
|
|
constructor(readonly effects: Effects, readonly id: string) {}
|
|
async bindLan(internalPort: number) {
|
|
const port = await this.effects.bindLan({
|
|
internalPort,
|
|
name: this.id,
|
|
});
|
|
const localAddress = `${await this.effects.getLocalHostname()}:${port}`;
|
|
const ipAddress = `${await this.effects.getIPHostname()}:${port}`;
|
|
return new LocalBinding(localAddress, ipAddress);
|
|
}
|
|
}
|