UNPKG

1.31 kBTypeScriptView Raw
1import type { MacAddress } from "hap-nodejs";
2import type { ChildBridgeFork } from "./childBridgeFork";
3export interface ExternalPortsConfiguration {
4 start: number;
5 end: number;
6}
7/**
8 * Allocates ports from the user defined `config.ports` option
9 * This service is used to allocate ports for external accessories on the main bridge, and child bridges.
10 */
11export declare class ExternalPortService {
12 private externalPorts?;
13 private nextExternalPort?;
14 private allocatedPorts;
15 constructor(externalPorts?: ExternalPortsConfiguration | undefined);
16 /**
17 * Returns the next available port in the external port config.
18 * If the external port is not configured by the user it will return null.
19 * If the port range has been exhausted it will return null.
20 */
21 requestPort(username: MacAddress): Promise<number | undefined>;
22 private getNextFreePort;
23}
24/**
25 * This is the child bridge version of the port allocation service.
26 * It requests a free port from the main bridge's port service.
27 */
28export declare class ChildBridgeExternalPortService extends ExternalPortService {
29 private childBridge;
30 constructor(childBridge: ChildBridgeFork);
31 requestPort(username: MacAddress): Promise<number | undefined>;
32}
33//# sourceMappingURL=externalPortService.d.ts.map
\No newline at end of file