service.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. disableIPv6?: boolean;
  15. }
  16. export interface ServiceRecord {
  17. name: string;
  18. type: 'PTR' | 'SRV' | 'TXT' | 'A' | 'AAAA';
  19. ttl: number;
  20. data: KeyValue | string | any;
  21. }
  22. export interface ServiceReferer {
  23. address: string;
  24. family: 'IPv4' | 'IPv6';
  25. port: number;
  26. size: number;
  27. }
  28. export declare class Service extends EventEmitter {
  29. name: string;
  30. type: string;
  31. protocol: 'tcp' | 'udp';
  32. port: number;
  33. host: string;
  34. fqdn: string;
  35. txt?: any;
  36. subtypes?: Array<string>;
  37. addresses?: Array<string>;
  38. referer?: ServiceReferer;
  39. disableIPv6: boolean;
  40. probe: boolean;
  41. published: boolean;
  42. activated: boolean;
  43. destroyed: boolean;
  44. start?: CallableFunction;
  45. stop?: CallableFunction;
  46. private txtService;
  47. constructor(config: ServiceConfig);
  48. records(): Array<ServiceRecord>;
  49. private RecordPTR;
  50. private RecordSubtypePTR;
  51. private RecordSRV;
  52. private RecordTXT;
  53. private RecordA;
  54. private RecordAAAA;
  55. }
  56. export default Service;