DefinitelyTyped/types/dnssd/index.d.ts
Max Rumpf a04576e800 [@types/dnssd] More fixes according the original source (#27877)
* Another set of fixes

* Fix lint

* Fix support for object type
2018-08-06 12:02:58 -07:00

90 lines
2.4 KiB
TypeScript

// Type definitions for dnssd 0.4
// Project: https://github.com/DeMille/dnssd.js#readme
// Definitions by: Angel Merino <https://github.com/angelmerino>
// Max Rumpf <https://github.com/Maxr1998>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
import { EventEmitter } from 'events';
/** Declaration file generated by dts-gen */
export class Advertisement extends EventEmitter {
constructor(type: string | string[] | ServiceType, port: number, ...args: any[]);
start(): Advertisement;
stop(forceImmediate?: boolean, callback?: () => any): void;
updateTXT(txtObj: any): void;
}
export class Options {
name?: string;
host?: string;
txt?: any;
subtypes?: string[];
interface?: string;
}
/**
* A service entry as returned by serviceUp
*/
export class Service {
fullname: string; // 'InstanceName._googlecast._tcp.local.'
name: string; // 'InstanceName'
type: ServiceType; // { name: 'googlecast'; protocol: 'tcp' }
domain: string; // 'local'
host: string; // 'Hostname.local.'
port: number; // 8009
addresses: string[]; // ['192.168.1.15']
txt: any; // { id: 'strings' }
txtRaw: any;
}
export class ServiceType {
constructor(...args: Array<string | string[]>)
constructor(args: ServiceType);
name: string;
protocol: string;
subtypes: string[];
toString(): string;
static all(): ServiceType;
static tcp(...args: string[]): ServiceType;
static udp(...args: string[]): ServiceType;
}
export class Browser extends EventEmitter {
constructor(type: string | string[] | ServiceType, ...args: any[]);
start(): Browser;
stop(): void;
list(): any[];
}
export function resolve(name: string, type: string, args: object): Promise<any>;
export function resolve4(name: string, type: string, args: object): Promise<string>;
export function resolve6(name: string, type: string, args: object): Promise<string>;
export function resolveSRV(name: string, args: object): Promise<any>;
export function resolveTXT(name: string, args: object): Promise<any>;
export function resolveService(name: string, args: object): Promise<any>;
export function tcp(...args: string[]): ServiceType;
export function udp(...args: string[]): ServiceType;
export function all(): ServiceType;