@devioarts/capacitor-mdns 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DevioartsCapacitorMdns.podspec +17 -0
- package/Package.swift +28 -0
- package/README.md +248 -0
- package/android/build.gradle +64 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/mDNS.kt +221 -0
- package/android/src/main/java/com/devioarts/capacitor/mdns/mDNSPlugin.kt +157 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +457 -0
- package/dist/esm/definitions.d.ts +190 -0
- package/dist/esm/definitions.js +3 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +17 -0
- package/dist/esm/web.js +41 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +55 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +58 -0
- package/dist/plugin.js.map +1 -0
- package/electron/global.d.ts +28 -0
- package/electron/mdns-bridge.cjs +29 -0
- package/electron/mdns.ts +267 -0
- package/ios/Sources/mDNSPlugin/mDNS.swift +436 -0
- package/ios/Sources/mDNSPlugin/mDNSPlugin.swift +125 -0
- package/ios/Tests/mDNSPluginTests/mDNSPluginTests.swift +15 -0
- package/package.json +96 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key–value map for TXT records of a Bonjour/mDNS service.
|
|
3
|
+
* Values are UTF-8 strings; binary payloads are not supported by this API.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare type MdnsTxt = Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Normalized description of a discovered Bonjour/mDNS service.
|
|
9
|
+
* Returned from {@link mDNSPlugin.discover}.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - `hosts` contains resolved IPv4/IPv6 numeric addresses (no DNS names).
|
|
13
|
+
* - iOS returns `txt` when present. Android (NSD) does not expose TXT records via public APIs,
|
|
14
|
+
* so `txt` is usually omitted on Android.
|
|
15
|
+
* - `domain` is typically `"local."`.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export interface MdnsService {
|
|
20
|
+
/** Instance name of the service (may be uniqued by the OS, e.g. "My App (2)"). */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Full service type including the trailing dot, e.g. `"_http._tcp."`. */
|
|
23
|
+
type: string;
|
|
24
|
+
/** Service domain; typically `"local."`. */
|
|
25
|
+
domain: string;
|
|
26
|
+
/** TCP port the service advertises. */
|
|
27
|
+
port: number;
|
|
28
|
+
/**
|
|
29
|
+
* Resolved numeric IP addresses (IPv4/IPv6).
|
|
30
|
+
* @example
|
|
31
|
+
* `["192.168.1.42", "fe80::1234:abcd:..."]`
|
|
32
|
+
*/
|
|
33
|
+
hosts: string[];
|
|
34
|
+
/**
|
|
35
|
+
* TXT dictionary (key → value). Usually present on iOS; Android NSD does not populate this.
|
|
36
|
+
* @remarks Not all services publish TXT data.
|
|
37
|
+
*/
|
|
38
|
+
txt?: MdnsTxt;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Options for starting a Bonjour/mDNS advertisement.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* - The `type` **must** end with a dot (`.`). If omitted, the implementation appends it.
|
|
45
|
+
* - Instance `name` should be short and human-readable; the OS may append `" (n)"` to ensure uniqueness.
|
|
46
|
+
* - Android NSD does not expose TXT records to other apps; advertising TXT is supported on iOS.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface MdnsBroadcastOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Service type (including the trailing dot).
|
|
53
|
+
* @defaultValue `"_http._tcp."`
|
|
54
|
+
* @example `"_myapp._tcp."`
|
|
55
|
+
*/
|
|
56
|
+
type?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Service instance name.
|
|
59
|
+
*/
|
|
60
|
+
name: string;
|
|
61
|
+
/**
|
|
62
|
+
* TCP port to advertise.
|
|
63
|
+
* @remarks Must be a positive integer (1–65535).
|
|
64
|
+
*/
|
|
65
|
+
port: number;
|
|
66
|
+
/**
|
|
67
|
+
* Optional TXT key–value pairs (UTF-8 strings).
|
|
68
|
+
* @remarks May be ignored on Android due to platform limitations.
|
|
69
|
+
*/
|
|
70
|
+
txt?: MdnsTxt;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for Bonjour/mDNS discovery.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* - The `id` filter matches the normalized name and also accepts prefix matches
|
|
77
|
+
* (to handle OS-added `" (n)"` suffixes).
|
|
78
|
+
* - When `useNW` is `true` on iOS, discovery uses `NWBrowser` for better P2P behavior.
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
export interface MdnsDiscoverOptions {
|
|
83
|
+
/**
|
|
84
|
+
* Service type (including the trailing dot).
|
|
85
|
+
* @defaultValue `"_http._tcp."`
|
|
86
|
+
* @example `"_comm._tcp."`
|
|
87
|
+
*/
|
|
88
|
+
type?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Optional instance name filter (prefix-safe).
|
|
91
|
+
* @example `"MyAppName"`
|
|
92
|
+
*/
|
|
93
|
+
name?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Discovery timeout in milliseconds.
|
|
96
|
+
* @defaultValue `3000`
|
|
97
|
+
*/
|
|
98
|
+
timeout?: number;
|
|
99
|
+
/**
|
|
100
|
+
* iOS-only hint to use `NWBrowser` instead of `NetServiceBrowser`.
|
|
101
|
+
* @defaultValue `true`
|
|
102
|
+
*/
|
|
103
|
+
useNW?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Result of startBroadcast(). Indicates whether advertising is active
|
|
107
|
+
* and the final service name. On failure, `error` is true and `errorMessage`
|
|
108
|
+
* describes the issue.
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export interface MdnsBroadcastResult {
|
|
112
|
+
/** True if the operation failed. */
|
|
113
|
+
error: boolean;
|
|
114
|
+
/** Error description or null on success. */
|
|
115
|
+
errorMessage: string | null;
|
|
116
|
+
/** Final (possibly uniquified) service instance name. Empty on failure. */
|
|
117
|
+
name: string;
|
|
118
|
+
/** Whether the advertiser is currently active. */
|
|
119
|
+
publishing: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Result of discover(). Contains normalized services and error information.
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export interface MdnsDiscoverResult {
|
|
126
|
+
/** True if discovery encountered an error (partial results may still be present). */
|
|
127
|
+
error: boolean;
|
|
128
|
+
/** Error description or null when no error occurred. */
|
|
129
|
+
errorMessage: string | null;
|
|
130
|
+
/** Convenience count equal to services.length. */
|
|
131
|
+
servicesFound: number;
|
|
132
|
+
/** Normalized list of discovered services. */
|
|
133
|
+
services: MdnsService[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Result of stopBroadcast(). Indicates whether the advertiser is active
|
|
137
|
+
* after the call (normally false) and includes error information.
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
export interface MdnsStopResult {
|
|
141
|
+
/** True if an error occurred while stopping. */
|
|
142
|
+
error: boolean;
|
|
143
|
+
/** Error description or null on success. */
|
|
144
|
+
errorMessage: string | null;
|
|
145
|
+
/** Whether the advertiser remains active (should be false on success). */
|
|
146
|
+
publishing: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Public API surface of the Capacitor mDNS plugin.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* import { mDNS } from 'capacitor-mdns';
|
|
154
|
+
*
|
|
155
|
+
* // Start advertising
|
|
156
|
+
* await mDNS.startBroadcast({ type: '_http._tcp.', name: 'my.app.id', port: 9235 });
|
|
157
|
+
*
|
|
158
|
+
* // Discover services
|
|
159
|
+
* const { services } = await mDNS.discover({ type: '_http._tcp.', timeout: 3000 });
|
|
160
|
+
*
|
|
161
|
+
* // Stop advertising
|
|
162
|
+
* await mDNS.stopBroadcast();
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
export interface mDNSPlugin {
|
|
168
|
+
/**
|
|
169
|
+
* Start advertising a Bonjour/mDNS service.
|
|
170
|
+
*
|
|
171
|
+
* @param options - {@link MdnsBroadcastOptions}
|
|
172
|
+
* @returns Promise resolving to `MdnsBroadcastResult` (`true` on success).
|
|
173
|
+
*/
|
|
174
|
+
startBroadcast(options: MdnsBroadcastOptions): Promise<MdnsBroadcastResult>;
|
|
175
|
+
/**
|
|
176
|
+
* Stop advertising the currently registered service (no-op if none).
|
|
177
|
+
*
|
|
178
|
+
* @returns Promise resolving to `MdnsStopResult`.
|
|
179
|
+
* @remarks The `publishing` flag may be `false` after a successful stop.
|
|
180
|
+
*/
|
|
181
|
+
stopBroadcast(): Promise<MdnsStopResult>;
|
|
182
|
+
/**
|
|
183
|
+
* Discover services of a given type and optionally filter by instance name.
|
|
184
|
+
*
|
|
185
|
+
* @param options - {@link MdnsDiscoverOptions}
|
|
186
|
+
* @returns Promise resolving to `MdnsDiscoverResult`.
|
|
187
|
+
* @remarks The result list is normalized across platforms. On Android, `txt` is typically absent.
|
|
188
|
+
*/
|
|
189
|
+
discover(options?: MdnsDiscoverOptions): Promise<MdnsDiscoverResult>;
|
|
190
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,qBAAqB","sourcesContent":["// src/definitions.ts\n\n/**\n * Key–value map for TXT records of a Bonjour/mDNS service.\n * Values are UTF-8 strings; binary payloads are not supported by this API.\n * @public\n */\nexport type MdnsTxt = Record<string, string>;\n\n/**\n * Normalized description of a discovered Bonjour/mDNS service.\n * Returned from {@link mDNSPlugin.discover}.\n *\n * @remarks\n * - `hosts` contains resolved IPv4/IPv6 numeric addresses (no DNS names).\n * - iOS returns `txt` when present. Android (NSD) does not expose TXT records via public APIs,\n * so `txt` is usually omitted on Android.\n * - `domain` is typically `\"local.\"`.\n *\n * @public\n */\nexport interface MdnsService {\n /** Instance name of the service (may be uniqued by the OS, e.g. \"My App (2)\"). */\n name: string;\n\n /** Full service type including the trailing dot, e.g. `\"_http._tcp.\"`. */\n type: string;\n\n /** Service domain; typically `\"local.\"`. */\n domain: string;\n\n /** TCP port the service advertises. */\n port: number;\n\n /**\n * Resolved numeric IP addresses (IPv4/IPv6).\n * @example\n * `[\"192.168.1.42\", \"fe80::1234:abcd:...\"]`\n */\n hosts: string[];\n\n /**\n * TXT dictionary (key → value). Usually present on iOS; Android NSD does not populate this.\n * @remarks Not all services publish TXT data.\n */\n txt?: MdnsTxt;\n}\n\n/**\n * Options for starting a Bonjour/mDNS advertisement.\n *\n * @remarks\n * - The `type` **must** end with a dot (`.`). If omitted, the implementation appends it.\n * - Instance `name` should be short and human-readable; the OS may append `\" (n)\"` to ensure uniqueness.\n * - Android NSD does not expose TXT records to other apps; advertising TXT is supported on iOS.\n *\n * @public\n */\nexport interface MdnsBroadcastOptions {\n /**\n * Service type (including the trailing dot).\n * @defaultValue `\"_http._tcp.\"`\n * @example `\"_myapp._tcp.\"`\n */\n type?: string;\n\n /**\n * Service instance name.\n */\n name: string;\n\n /**\n * TCP port to advertise.\n * @remarks Must be a positive integer (1–65535).\n */\n port: number;\n\n /**\n * Optional TXT key–value pairs (UTF-8 strings).\n * @remarks May be ignored on Android due to platform limitations.\n */\n txt?: MdnsTxt;\n}\n\n/**\n * Options for Bonjour/mDNS discovery.\n *\n * @remarks\n * - The `id` filter matches the normalized name and also accepts prefix matches\n * (to handle OS-added `\" (n)\"` suffixes).\n * - When `useNW` is `true` on iOS, discovery uses `NWBrowser` for better P2P behavior.\n *\n * @public\n */\nexport interface MdnsDiscoverOptions {\n /**\n * Service type (including the trailing dot).\n * @defaultValue `\"_http._tcp.\"`\n * @example `\"_comm._tcp.\"`\n */\n type?: string;\n\n /**\n * Optional instance name filter (prefix-safe).\n * @example `\"MyAppName\"`\n */\n name?: string;\n\n /**\n * Discovery timeout in milliseconds.\n * @defaultValue `3000`\n */\n timeout?: number;\n\n /**\n * iOS-only hint to use `NWBrowser` instead of `NetServiceBrowser`.\n * @defaultValue `true`\n */\n useNW?: boolean;\n}\n\n/**\n * Result of startBroadcast(). Indicates whether advertising is active\n * and the final service name. On failure, `error` is true and `errorMessage`\n * describes the issue.\n * @public\n */\nexport interface MdnsBroadcastResult {\n /** True if the operation failed. */\n error: boolean;\n /** Error description or null on success. */\n errorMessage: string | null;\n /** Final (possibly uniquified) service instance name. Empty on failure. */\n name: string;\n /** Whether the advertiser is currently active. */\n publishing: boolean;\n}\n\n/**\n * Result of discover(). Contains normalized services and error information.\n * @public\n */\nexport interface MdnsDiscoverResult {\n /** True if discovery encountered an error (partial results may still be present). */\n error: boolean;\n /** Error description or null when no error occurred. */\n errorMessage: string | null;\n /** Convenience count equal to services.length. */\n servicesFound: number;\n /** Normalized list of discovered services. */\n services: MdnsService[];\n}\n\n/**\n * Result of stopBroadcast(). Indicates whether the advertiser is active\n * after the call (normally false) and includes error information.\n * @public\n */\nexport interface MdnsStopResult {\n /** True if an error occurred while stopping. */\n error: boolean;\n /** Error description or null on success. */\n errorMessage: string | null;\n /** Whether the advertiser remains active (should be false on success). */\n publishing: boolean;\n}\n\n/**\n * Public API surface of the Capacitor mDNS plugin.\n *\n * @example\n * ```ts\n * import { mDNS } from 'capacitor-mdns';\n *\n * // Start advertising\n * await mDNS.startBroadcast({ type: '_http._tcp.', name: 'my.app.id', port: 9235 });\n *\n * // Discover services\n * const { services } = await mDNS.discover({ type: '_http._tcp.', timeout: 3000 });\n *\n * // Stop advertising\n * await mDNS.stopBroadcast();\n * ```\n *\n * @public\n */\nexport interface mDNSPlugin {\n /**\n * Start advertising a Bonjour/mDNS service.\n *\n * @param options - {@link MdnsBroadcastOptions}\n * @returns Promise resolving to `MdnsBroadcastResult` (`true` on success).\n */\n startBroadcast(options: MdnsBroadcastOptions): Promise<MdnsBroadcastResult>;\n\n /**\n * Stop advertising the currently registered service (no-op if none).\n *\n * @returns Promise resolving to `MdnsStopResult`.\n * @remarks The `publishing` flag may be `false` after a successful stop.\n */\n stopBroadcast(): Promise<MdnsStopResult>;\n\n /**\n * Discover services of a given type and optionally filter by instance name.\n *\n * @param options - {@link MdnsDiscoverOptions}\n * @returns Promise resolving to `MdnsDiscoverResult`.\n * @remarks The result list is normalized across platforms. On Android, `txt` is typically absent.\n */\n discover(options?: MdnsDiscoverOptions): Promise<MdnsDiscoverResult>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,IAAI,GAAG,cAAc,CAAa,MAAM,EAAE;IAC9C,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;CACxD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { mDNSPlugin } from './definitions';\n\nconst mDNS = registerPlugin<mDNSPlugin>('mDNS', {\n web: () => import('./web').then((m) => new m.mDNSWeb()),\n});\n\nexport * from './definitions';\nexport { mDNS };\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { mDNSPlugin, MdnsBroadcastOptions, MdnsDiscoverOptions, MdnsBroadcastResult, MdnsStopResult, MdnsDiscoverResult } from './definitions';
|
|
3
|
+
/**
|
|
4
|
+
* Web implementation of the mDNS plugin.
|
|
5
|
+
*
|
|
6
|
+
* This class behaves as a thin proxy:
|
|
7
|
+
* - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.
|
|
8
|
+
* - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values
|
|
9
|
+
* and log a console message with the [WEB_NOT_SUPPORTED] tag.
|
|
10
|
+
*/
|
|
11
|
+
export declare class mDNSWeb extends WebPlugin implements mDNSPlugin {
|
|
12
|
+
/** Electron preload bridge (if present). */
|
|
13
|
+
private get electronApi();
|
|
14
|
+
startBroadcast(options: MdnsBroadcastOptions): Promise<MdnsBroadcastResult>;
|
|
15
|
+
stopBroadcast(): Promise<MdnsStopResult>;
|
|
16
|
+
discover(options?: MdnsDiscoverOptions): Promise<MdnsDiscoverResult>;
|
|
17
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/web.ts
|
|
2
|
+
import { WebPlugin } from '@capacitor/core';
|
|
3
|
+
/**
|
|
4
|
+
* Web implementation of the mDNS plugin.
|
|
5
|
+
*
|
|
6
|
+
* This class behaves as a thin proxy:
|
|
7
|
+
* - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.
|
|
8
|
+
* - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values
|
|
9
|
+
* and log a console message with the [WEB_NOT_SUPPORTED] tag.
|
|
10
|
+
*/
|
|
11
|
+
export class mDNSWeb extends WebPlugin {
|
|
12
|
+
/** Electron preload bridge (if present). */
|
|
13
|
+
get electronApi() {
|
|
14
|
+
if (typeof window === 'undefined')
|
|
15
|
+
return undefined;
|
|
16
|
+
return window.mDNS || window.mdns;
|
|
17
|
+
}
|
|
18
|
+
async startBroadcast(options) {
|
|
19
|
+
const api = this.electronApi;
|
|
20
|
+
if (api === null || api === void 0 ? void 0 : api.startBroadcast)
|
|
21
|
+
return api.startBroadcast(options);
|
|
22
|
+
console.log('[WEB_NOT_SUPPORTED] startBroadcast', options);
|
|
23
|
+
// Keep the shape consistent even when not supported
|
|
24
|
+
return { publishing: true, name: '', error: false, errorMessage: null };
|
|
25
|
+
}
|
|
26
|
+
async stopBroadcast() {
|
|
27
|
+
const api = this.electronApi;
|
|
28
|
+
if (api === null || api === void 0 ? void 0 : api.stopBroadcast)
|
|
29
|
+
return api.stopBroadcast();
|
|
30
|
+
console.log('[WEB_NOT_SUPPORTED] stopBroadcast');
|
|
31
|
+
return { publishing: false, error: false, errorMessage: null };
|
|
32
|
+
}
|
|
33
|
+
async discover(options = {}) {
|
|
34
|
+
const api = this.electronApi;
|
|
35
|
+
if (api === null || api === void 0 ? void 0 : api.discover)
|
|
36
|
+
return api.discover(options);
|
|
37
|
+
console.log('[WEB_NOT_SUPPORTED] discover', options);
|
|
38
|
+
return { services: [], error: false, errorMessage: null, servicesFound: 0 };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C;;;;;;;GAOG;AACH,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC,4CAA4C;IAC5C,IAAY,WAAW;QAOrB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO,SAAS,CAAC;QACpD,OAAQ,MAAc,CAAC,IAAI,IAAK,MAAc,CAAC,IAAI,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA6B;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7B,IAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,cAAc;YAAE,OAAO,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;QAC3D,oDAAoD;QACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7B,IAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa;YAAE,OAAO,GAAG,CAAC,aAAa,EAAE,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAA+B,EAAE;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7B,IAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ;YAAE,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;QACrD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAC9E,CAAC;CACF","sourcesContent":["// src/web.ts\nimport { WebPlugin } from '@capacitor/core';\n\nimport type {\n mDNSPlugin,\n MdnsBroadcastOptions,\n MdnsDiscoverOptions,\n MdnsBroadcastResult,\n MdnsStopResult,\n MdnsDiscoverResult,\n} from './definitions';\n\n/**\n * Web implementation of the mDNS plugin.\n *\n * This class behaves as a thin proxy:\n * - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.\n * - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values\n * and log a console message with the [WEB_NOT_SUPPORTED] tag.\n */\nexport class mDNSWeb extends WebPlugin implements mDNSPlugin {\n /** Electron preload bridge (if present). */\n private get electronApi():\n | undefined\n | {\n startBroadcast(o: MdnsBroadcastOptions): Promise<MdnsBroadcastResult>;\n stopBroadcast(): Promise<MdnsStopResult>;\n discover(o?: MdnsDiscoverOptions): Promise<MdnsDiscoverResult>;\n } {\n if (typeof window === 'undefined') return undefined;\n return (window as any).mDNS || (window as any).mdns;\n }\n\n async startBroadcast(options: MdnsBroadcastOptions): Promise<MdnsBroadcastResult> {\n const api = this.electronApi;\n if (api?.startBroadcast) return api.startBroadcast(options);\n console.log('[WEB_NOT_SUPPORTED] startBroadcast', options);\n // Keep the shape consistent even when not supported\n return { publishing: true, name: '', error: false, errorMessage: null };\n }\n\n async stopBroadcast(): Promise<MdnsStopResult> {\n const api = this.electronApi;\n if (api?.stopBroadcast) return api.stopBroadcast();\n console.log('[WEB_NOT_SUPPORTED] stopBroadcast');\n return { publishing: false, error: false, errorMessage: null };\n }\n\n async discover(options: MdnsDiscoverOptions = {}): Promise<MdnsDiscoverResult> {\n const api = this.electronApi;\n if (api?.discover) return api.discover(options);\n console.log('[WEB_NOT_SUPPORTED] discover', options);\n return { services: [], error: false, errorMessage: null, servicesFound: 0 };\n }\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const mDNS = core.registerPlugin('mDNS', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.mDNSWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// src/web.ts
|
|
10
|
+
/**
|
|
11
|
+
* Web implementation of the mDNS plugin.
|
|
12
|
+
*
|
|
13
|
+
* This class behaves as a thin proxy:
|
|
14
|
+
* - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.
|
|
15
|
+
* - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values
|
|
16
|
+
* and log a console message with the [WEB_NOT_SUPPORTED] tag.
|
|
17
|
+
*/
|
|
18
|
+
class mDNSWeb extends core.WebPlugin {
|
|
19
|
+
/** Electron preload bridge (if present). */
|
|
20
|
+
get electronApi() {
|
|
21
|
+
if (typeof window === 'undefined')
|
|
22
|
+
return undefined;
|
|
23
|
+
return window.mDNS || window.mdns;
|
|
24
|
+
}
|
|
25
|
+
async startBroadcast(options) {
|
|
26
|
+
const api = this.electronApi;
|
|
27
|
+
if (api === null || api === void 0 ? void 0 : api.startBroadcast)
|
|
28
|
+
return api.startBroadcast(options);
|
|
29
|
+
console.log('[WEB_NOT_SUPPORTED] startBroadcast', options);
|
|
30
|
+
// Keep the shape consistent even when not supported
|
|
31
|
+
return { publishing: true, name: '', error: false, errorMessage: null };
|
|
32
|
+
}
|
|
33
|
+
async stopBroadcast() {
|
|
34
|
+
const api = this.electronApi;
|
|
35
|
+
if (api === null || api === void 0 ? void 0 : api.stopBroadcast)
|
|
36
|
+
return api.stopBroadcast();
|
|
37
|
+
console.log('[WEB_NOT_SUPPORTED] stopBroadcast');
|
|
38
|
+
return { publishing: false, error: false, errorMessage: null };
|
|
39
|
+
}
|
|
40
|
+
async discover(options = {}) {
|
|
41
|
+
const api = this.electronApi;
|
|
42
|
+
if (api === null || api === void 0 ? void 0 : api.discover)
|
|
43
|
+
return api.discover(options);
|
|
44
|
+
console.log('[WEB_NOT_SUPPORTED] discover', options);
|
|
45
|
+
return { services: [], error: false, errorMessage: null, servicesFound: 0 };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
50
|
+
__proto__: null,
|
|
51
|
+
mDNSWeb: mDNSWeb
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
exports.mDNS = mDNS;
|
|
55
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst mDNS = registerPlugin('mDNS', {\n web: () => import('./web').then((m) => new m.mDNSWeb()),\n});\nexport * from './definitions';\nexport { mDNS };\n//# sourceMappingURL=index.js.map","// src/web.ts\nimport { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation of the mDNS plugin.\n *\n * This class behaves as a thin proxy:\n * - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.\n * - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values\n * and log a console message with the [WEB_NOT_SUPPORTED] tag.\n */\nexport class mDNSWeb extends WebPlugin {\n /** Electron preload bridge (if present). */\n get electronApi() {\n if (typeof window === 'undefined')\n return undefined;\n return window.mDNS || window.mdns;\n }\n async startBroadcast(options) {\n const api = this.electronApi;\n if (api === null || api === void 0 ? void 0 : api.startBroadcast)\n return api.startBroadcast(options);\n console.log('[WEB_NOT_SUPPORTED] startBroadcast', options);\n // Keep the shape consistent even when not supported\n return { publishing: true, name: '', error: false, errorMessage: null };\n }\n async stopBroadcast() {\n const api = this.electronApi;\n if (api === null || api === void 0 ? void 0 : api.stopBroadcast)\n return api.stopBroadcast();\n console.log('[WEB_NOT_SUPPORTED] stopBroadcast');\n return { publishing: false, error: false, errorMessage: null };\n }\n async discover(options = {}) {\n const api = this.electronApi;\n if (api === null || api === void 0 ? void 0 : api.discover)\n return api.discover(options);\n console.log('[WEB_NOT_SUPPORTED] discover', options);\n return { services: [], error: false, errorMessage: null, servicesFound: 0 };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;AACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AAC3D,CAAC;;ACHD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,OAAO,SAASC,cAAS,CAAC;AACvC;AACA,IAAI,IAAI,WAAW,GAAG;AACtB,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW;AACzC,YAAY,OAAO,SAAS;AAC5B,QAAQ,OAAO,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI;AACzC,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,OAAO,EAAE;AAClC,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW;AACpC,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,cAAc;AACxE,YAAY,OAAO,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC;AAC9C,QAAQ,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,OAAO,CAAC;AAClE;AACA,QAAQ,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;AAC/E,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW;AACpC,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,aAAa;AACvE,YAAY,OAAO,GAAG,CAAC,aAAa,EAAE;AACtC,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC;AACxD,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;AACtE,IAAI;AACJ,IAAI,MAAM,QAAQ,CAAC,OAAO,GAAG,EAAE,EAAE;AACjC,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW;AACpC,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,QAAQ;AAClE,YAAY,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;AACxC,QAAQ,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC;AAC5D,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE;AACnF,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var capacitormDNS = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const mDNS = core.registerPlugin('mDNS', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.mDNSWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/web.ts
|
|
9
|
+
/**
|
|
10
|
+
* Web implementation of the mDNS plugin.
|
|
11
|
+
*
|
|
12
|
+
* This class behaves as a thin proxy:
|
|
13
|
+
* - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.
|
|
14
|
+
* - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values
|
|
15
|
+
* and log a console message with the [WEB_NOT_SUPPORTED] tag.
|
|
16
|
+
*/
|
|
17
|
+
class mDNSWeb extends core.WebPlugin {
|
|
18
|
+
/** Electron preload bridge (if present). */
|
|
19
|
+
get electronApi() {
|
|
20
|
+
if (typeof window === 'undefined')
|
|
21
|
+
return undefined;
|
|
22
|
+
return window.mDNS || window.mdns;
|
|
23
|
+
}
|
|
24
|
+
async startBroadcast(options) {
|
|
25
|
+
const api = this.electronApi;
|
|
26
|
+
if (api === null || api === void 0 ? void 0 : api.startBroadcast)
|
|
27
|
+
return api.startBroadcast(options);
|
|
28
|
+
console.log('[WEB_NOT_SUPPORTED] startBroadcast', options);
|
|
29
|
+
// Keep the shape consistent even when not supported
|
|
30
|
+
return { publishing: true, name: '', error: false, errorMessage: null };
|
|
31
|
+
}
|
|
32
|
+
async stopBroadcast() {
|
|
33
|
+
const api = this.electronApi;
|
|
34
|
+
if (api === null || api === void 0 ? void 0 : api.stopBroadcast)
|
|
35
|
+
return api.stopBroadcast();
|
|
36
|
+
console.log('[WEB_NOT_SUPPORTED] stopBroadcast');
|
|
37
|
+
return { publishing: false, error: false, errorMessage: null };
|
|
38
|
+
}
|
|
39
|
+
async discover(options = {}) {
|
|
40
|
+
const api = this.electronApi;
|
|
41
|
+
if (api === null || api === void 0 ? void 0 : api.discover)
|
|
42
|
+
return api.discover(options);
|
|
43
|
+
console.log('[WEB_NOT_SUPPORTED] discover', options);
|
|
44
|
+
return { services: [], error: false, errorMessage: null, servicesFound: 0 };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
49
|
+
__proto__: null,
|
|
50
|
+
mDNSWeb: mDNSWeb
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
exports.mDNS = mDNS;
|
|
54
|
+
|
|
55
|
+
return exports;
|
|
56
|
+
|
|
57
|
+
})({}, capacitorExports);
|
|
58
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst mDNS = registerPlugin('mDNS', {\n web: () => import('./web').then((m) => new m.mDNSWeb()),\n});\nexport * from './definitions';\nexport { mDNS };\n//# sourceMappingURL=index.js.map","// src/web.ts\nimport { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation of the mDNS plugin.\n *\n * This class behaves as a thin proxy:\n * - In Electron (when a preload exposes window.mDNS/window.mdns), calls are forwarded over IPC.\n * - In a regular browser, mDNS is not available; methods resolve with well-shaped stub values\n * and log a console message with the [WEB_NOT_SUPPORTED] tag.\n */\nexport class mDNSWeb extends WebPlugin {\n /** Electron preload bridge (if present). */\n get electronApi() {\n if (typeof window === 'undefined')\n return undefined;\n return window.mDNS || window.mdns;\n }\n async startBroadcast(options) {\n const api = this.electronApi;\n if (api === null || api === void 0 ? void 0 : api.startBroadcast)\n return api.startBroadcast(options);\n console.log('[WEB_NOT_SUPPORTED] startBroadcast', options);\n // Keep the shape consistent even when not supported\n return { publishing: true, name: '', error: false, errorMessage: null };\n }\n async stopBroadcast() {\n const api = this.electronApi;\n if (api === null || api === void 0 ? void 0 : api.stopBroadcast)\n return api.stopBroadcast();\n console.log('[WEB_NOT_SUPPORTED] stopBroadcast');\n return { publishing: false, error: false, errorMessage: null };\n }\n async discover(options = {}) {\n const api = this.electronApi;\n if (api === null || api === void 0 ? void 0 : api.discover)\n return api.discover(options);\n console.log('[WEB_NOT_SUPPORTED] discover', options);\n return { services: [], error: false, errorMessage: null, servicesFound: 0 };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;IACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3D,CAAC;;ICHD;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACO,MAAM,OAAO,SAASC,cAAS,CAAC;IACvC;IACA,IAAI,IAAI,WAAW,GAAG;IACtB,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW;IACzC,YAAY,OAAO,SAAS;IAC5B,QAAQ,OAAO,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI;IACzC,IAAI;IACJ,IAAI,MAAM,cAAc,CAAC,OAAO,EAAE;IAClC,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW;IACpC,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,cAAc;IACxE,YAAY,OAAO,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC;IAC9C,QAAQ,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,OAAO,CAAC;IAClE;IACA,QAAQ,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;IAC/E,IAAI;IACJ,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW;IACpC,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,aAAa;IACvE,YAAY,OAAO,GAAG,CAAC,aAAa,EAAE;IACtC,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC;IACxD,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;IACtE,IAAI;IACJ,IAAI,MAAM,QAAQ,CAAC,OAAO,GAAG,EAAE,EAAE;IACjC,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW;IACpC,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,QAAQ;IAClE,YAAY,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;IACxC,QAAQ,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC;IAC5D,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE;IACnF,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// electron/global.d.ts
|
|
2
|
+
import type {
|
|
3
|
+
MdnsBroadcastOptions,
|
|
4
|
+
MdnsBroadcastResult,
|
|
5
|
+
MdnsDiscoverOptions,
|
|
6
|
+
MdnsDiscoverResult,
|
|
7
|
+
MdnsStopResult,
|
|
8
|
+
} from '../src/definitions'; // Types only; no runtime import
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
/**
|
|
13
|
+
* Electron mDNS API bridge (preload). Mirrors Capacitor methods.
|
|
14
|
+
* Primary name with the same casing as iOS jsName.
|
|
15
|
+
*/
|
|
16
|
+
mDNS: {
|
|
17
|
+
startBroadcast(options: MdnsBroadcastOptions): Promise<MdnsBroadcastResult>;
|
|
18
|
+
stopBroadcast(): Promise<MdnsStopResult>;
|
|
19
|
+
discover(options?: MdnsDiscoverOptions): Promise<MdnsDiscoverResult>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Lowercase alias for convenience.
|
|
23
|
+
*/
|
|
24
|
+
mdns: Window['mDNS'];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// electron/mdns-bridge.cjs
|
|
2
|
+
// Usage in preload:
|
|
3
|
+
// const { createMDNSAPI } = require('.../electron/mdns-bridge.cjs')
|
|
4
|
+
// contextBridge.exposeInMainWorld('mDNS', createMDNSAPI({ ipcRenderer }))
|
|
5
|
+
// contextBridge.exposeInMainWorld('mdns', createMDNSAPI({ ipcRenderer })) // alias
|
|
6
|
+
// eslint-disable-next-line no-undef
|
|
7
|
+
module.exports.createMDNSAPI = ({ ipcRenderer }) => {
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* Start advertising a Bonjour/mDNS service.
|
|
11
|
+
* @param {{type?: string, name: string, port: number, txt?: Record<string,string>}} options
|
|
12
|
+
* @returns {Promise<{publishing: boolean, name: string, error: boolean, errorMessage: string|null}>}
|
|
13
|
+
*/
|
|
14
|
+
startBroadcast: (options) => ipcRenderer.invoke('mdns:startBroadcast', options),
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Stop advertising (no-op if not running).
|
|
18
|
+
* @returns {Promise<{publishing: boolean}>}
|
|
19
|
+
*/
|
|
20
|
+
stopBroadcast: () => ipcRenderer.invoke('mdns:stopBroadcast'),
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Discover services of a given type, optional normalized exact/prefix name filter.
|
|
24
|
+
* @param {{type?: string, id?: string, timeoutMs?: number}} [options]
|
|
25
|
+
* @returns {Promise<{services: Array<{name:string,type:string,domain:string,port:number,hosts?:string[],txt?:Record<string,string>}>}>}
|
|
26
|
+
*/
|
|
27
|
+
discover: (options) => ipcRenderer.invoke('mdns:discover', options),
|
|
28
|
+
}
|
|
29
|
+
}
|