service.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. start: CallableFunction;
  29. stop: CallableFunction;
  30. name: string;
  31. type: string;
  32. protocol: 'tcp' | 'udp';
  33. port: number;
  34. host: string;
  35. fqdn: string;
  36. txt?: any;
  37. subtypes?: Array<string>;
  38. addresses?: Array<string>;
  39. referer?: ServiceReferer;
  40. disableIPv6: boolean;
  41. lastSeen?: number;
  42. ttl?: number;
  43. probe: boolean;
  44. published: boolean;
  45. activated: boolean;
  46. destroyed: boolean;
  47. private txtService;
  48. constructor(config: ServiceConfig, start: CallableFunction, stop: CallableFunction);
  49. records(): Array<ServiceRecord>;
  50. private RecordPTR;
  51. private RecordServicePTR;
  52. private RecordSubtypePTR;
  53. private RecordSRV;
  54. private RecordTXT;
  55. private RecordA;
  56. private RecordAAAA;
  57. }
  58. export default Service;