mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 18:31:54 +00:00
17 lines
513 B
TypeScript
17 lines
513 B
TypeScript
import { Effects } from "../types"
|
|
import { LocalBinding } from "./LocalBinding"
|
|
|
|
export class LocalPort {
|
|
constructor(readonly effects: Effects) {}
|
|
static async bindLan(effects: Effects, internalPort: number) {
|
|
const port = await effects.bindLan({
|
|
internalPort,
|
|
})
|
|
const localAddress = `${await effects.getLocalHostname()}:${port}`
|
|
const ipAddress = await (
|
|
await effects.getIPHostname()
|
|
).map((x) => `${x}:${port}`)
|
|
return new LocalBinding(localAddress, ipAddress)
|
|
}
|
|
}
|