UNPKG

lokal-js

Version:

Library for interacting with Lokal.so Client REST API

73 lines (72 loc) 2.19 kB
type TunnelType = 'HTTP' | 'TCP' | 'UDP'; interface TunnelOptions { basic_auth?: string[]; cidr_allow?: string[]; cidr_deny?: string[]; request_header_add?: string[]; request_header_remove?: string[]; response_header_add?: string[]; response_header_remove?: string[]; header_key?: string[]; } interface TunnelData { id?: string; name: string; tunnel_type: TunnelType; local_address: string; server_id?: string; address_tunnel?: string; address_tunnel_port?: number; address_public?: string; address_mdns?: string; inspect: boolean; options: TunnelOptions; } declare class Lokal { private baseURL; private basicAuth; private token; private debug; private skip_tls; constructor(baseURL?: string); setBaseURL(url: string): Lokal; setBasicAuth(username: string, password: string): Lokal; skipTLSVerify(): Lokal; setAPIToken(token: string): Lokal; debugMode(enable: boolean): Lokal; logDebug(...args: any[]): void; request(endpoint: string, method?: string, body?: any): Promise<any>; private isValidVersion; newTunnel(): Tunnel; } declare class Tunnel implements TunnelData { private lokal; id?: string; name: string; tunnel_type: TunnelType; local_address: string; server_id?: string; address_tunnel?: string; address_tunnel_port?: number; address_public?: string; address_mdns?: string; inspect: boolean; options: TunnelOptions; private ignoreDuplicateFlag; private startupBannerFlag; constructor(lokal: Lokal); setLocalAddress(localAddress: string): Tunnel; setTunnelType(tunnelType: TunnelType): Tunnel; setInspection(inspect: boolean): Tunnel; setLANAddress(lanAddress: string): Tunnel; setPublicAddress(publicAddress: string): Tunnel; setName(name: string): Tunnel; ignoreDuplicate(): Tunnel; showStartupBanner(): Tunnel; create(): Promise<Tunnel>; getLANAddress(): Promise<string>; getPublicAddress(): Promise<string>; private updatePublicURLPort; private showBanner; } export { Lokal, Tunnel, TunnelType, TunnelOptions, TunnelData };