service.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /// <reference types="node" />
  2. import KeyValue from './KeyValue';
  3. import { EventEmitter } from 'events';
  4. export interface ServiceConfig {
  5. name: string;
  6. type: string;
  7. port: number;
  8. protocol?: 'tcp' | 'udp';
  9. host?: string;
  10. fqdn?: string;
  11. subtypes?: Array<string>;
  12. txt?: KeyValue;
  13. probe?: boolean;
  14. }
  15. export interface ServiceRecord {
  16. name: string;
  17. type: 'PTR' | 'SRV' | 'TXT' | 'A' | 'AAAA';
  18. ttl: number;
  19. data: KeyValue | string | any;
  20. }
  21. export interface ServiceReferer {
  22. address: string;
  23. family: 'IPv4' | 'IPv6';
  24. port: number;
  25. size: number;
  26. }
  27. export declare class Service extends EventEmitter {
  28. name: string;
  29. type: string;
  30. protocol: 'tcp' | 'udp';
  31. port: number;
  32. host: string;
  33. fqdn: string;
  34. txt?: any;
  35. subtypes?: Array<string>;
  36. addresses?: Array<string>;
  37. referer?: ServiceReferer;
  38. probe: boolean;
  39. published: boolean;
  40. activated: boolean;
  41. destroyed: boolean;
  42. start?: any;
  43. stop?: any;
  44. private txtService;
  45. constructor(config: ServiceConfig);
  46. records(): Array<ServiceRecord>;
  47. private RecordPTR;
  48. private RecordSubtypePTR;
  49. private RecordSRV;
  50. private RecordTXT;
  51. private RecordA;
  52. private RecordAAAA;
  53. }
  54. export default Service;