export declare enum Transport { direct = "direct", stdio = "stdio", pipe = "pipe", uds = "uds", vsock = "vsock", tcp = "tcp", http = "http", ws = "ws" } export declare class DirectAddress { readonly type: Transport.direct; readonly server: any; constructor(server: any); url(): string; } export declare type DirectAddressInitializer = Pick; export declare type StdioAddressInitializer = string | Pick; export declare class StdioAddress { readonly type: Transport.stdio; readonly command: string; readonly args?: string[]; readonly cwd?: string; constructor(address: StdioAddressInitializer); url(): string; } /** * An initializer for a `PipeAddress`. */ export declare type PipeAddressInitializer = string; /** * An address representing the base path to a pair * of named pipes `
.in` and `
.out`. * Other files may be associated with this address e.g. `
.lock`. * * @see {@link https://en.wikipedia.org/wiki/Named_pipe Wikipedia} */ export declare class PipeAddress extends String { readonly type: Transport.pipe; constructor(address: PipeAddressInitializer); url(): string; } /** * An address in the Unix Domain Socket (UDS) address family * * @see {@link https://en.wikipedia.org/wiki/Unix_domain_socket Wikipedia} */ export declare class UdsAddress { readonly type: Transport.uds; /** * The file system path to the socket */ readonly path: string; constructor(path: string); url(): string; } /** * An address in the Linux VSOCK address family * * @see {@link http://man7.org/linux/man-pages/man7/vsock.7.html Linux man page} */ export declare class VsockAddress { readonly type: Transport.vsock; /** * The port number */ readonly port: number; /** * The file system path to the socket * * Although VSOCK addresses do not include a path, * Firecracker uses a UDS on the host. This allows * for that use case. */ readonly path?: string; constructor(port?: number, path?: string); url(): string; } export interface TcpAddressProperties { scheme: string; host: string; port: number; } export declare type TcpAddressInitializer = number | string | Partial; export declare class TcpAddress { readonly type: Transport.tcp | Transport.http | Transport.ws; readonly scheme: string; readonly host: string; readonly port: number; constructor(address?: TcpAddressInitializer, defaults?: TcpAddressProperties); url(): string; } export interface HttpAddressProperties extends TcpAddressProperties { path?: string; jwt?: string; protocol?: 'jsonrpc' | 'restful'; } export declare type HttpAddressInitializer = number | string | Partial; /** * An address in the HTTP address family * * @see {@link https://www.w3.org/Addressing/HTTPAddressing.html HTTP Addressing } */ export declare class HttpAddress extends TcpAddress { readonly type: Transport.http | Transport.ws; /** * The path for the address. * * Should begin with a forward slash e.g. `/some/route` */ readonly path?: string; /** * The JSON Web Token (JWT) to use add to requests * to this address. */ readonly jwt?: string; /** * The API protocol to use. * * When `jsonrpc`, then all requests and responses should be within * a JSON-RPC envelope with `id`, `method`, `params` etc. * * When `restful`, then the HTTP path is the method (e.g. `/manifest`) * and the body is the `params` object. (This isn't really RESTful, * but the API calls are stylistically similar ¯\_(ツ)_/¯) */ readonly protocol?: 'jsonrpc' | 'restful'; constructor(address?: HttpAddressInitializer, defaults?: HttpAddressProperties); } export declare type WebSocketAddressInitializer = HttpAddressInitializer; export declare class WebSocketAddress extends HttpAddress { readonly type: Transport.ws; constructor(address?: WebSocketAddressInitializer); } export declare type Address = DirectAddress | StdioAddress | PipeAddress | UdsAddress | VsockAddress | TcpAddress | HttpAddress | WebSocketAddress; export interface Addresses { direct?: DirectAddressInitializer; stdio?: StdioAddressInitializer; pipe?: PipeAddressInitializer; uds?: UdsAddress; vsock?: VsockAddress; tcp?: TcpAddressInitializer | TcpAddressInitializer[]; http?: HttpAddressInitializer | HttpAddressInitializer[]; ws?: WebSocketAddressInitializer | WebSocketAddressInitializer[]; } export declare function parseTcpAddress(address: undefined | TcpAddressInitializer | HttpAddressInitializer, defaults: TcpAddressProperties | HttpAddressProperties): Pick; /** * Create a URL from a TCP-based address. Inverse of `parseTcpAddress`. * * @param address The address to deparse. */ export declare function deparseTcpAddress(address: Pick): string; export declare function parseAddress(address: string): Address | undefined;