service.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 RecordSRV;
  49. private RecordTXT;
  50. private RecordA;
  51. private RecordAAAA;
  52. }
  53. export default Service;