service.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import KeyValue from './KeyValue';
  2. import { EventEmitter } from 'events';
  3. export interface ServiceConfig {
  4. name: string;
  5. type: string;
  6. port: number;
  7. protocol?: 'tcp' | 'udp';
  8. host?: string;
  9. fqdn?: string;
  10. subtypes?: Array<string>;
  11. txt?: KeyValue;
  12. probe?: boolean;
  13. disableIPv6?: 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. disableIPv6: boolean;
  39. probe: boolean;
  40. published: boolean;
  41. activated: boolean;
  42. destroyed: boolean;
  43. start?: CallableFunction;
  44. stop?: CallableFunction;
  45. private txtService;
  46. constructor(config: ServiceConfig);
  47. records(): Array<ServiceRecord>;
  48. private RecordPTR;
  49. private RecordSubtypePTR;
  50. private RecordSRV;
  51. private RecordTXT;
  52. private RecordA;
  53. private RecordAAAA;
  54. }
  55. export default Service;