electron-cast 0.4.0 → 0.5.0-next.1
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/CHANGELOG.md +280 -0
- package/CONTRIBUTING.md +305 -0
- package/README.md +211 -165
- package/SECURITY.md +324 -0
- package/dist/cjs/client/auth/build-time.js +1 -1
- package/dist/cjs/client/auth/cast-auth.d.ts +2 -0
- package/dist/cjs/client/auth/cast-auth.js.map +1 -1
- package/dist/cjs/dial/dial-registry.d.ts +104 -0
- package/dist/cjs/dial/dial-registry.js +301 -0
- package/dist/cjs/dial/dial-registry.js.map +1 -0
- package/dist/cjs/dial/dial-sink-service.d.ts +108 -0
- package/dist/cjs/dial/dial-sink-service.js +314 -0
- package/dist/cjs/dial/dial-sink-service.js.map +1 -0
- package/dist/cjs/dial/http.d.ts +40 -0
- package/dist/cjs/dial/http.js +172 -0
- package/dist/cjs/dial/http.js.map +1 -0
- package/dist/cjs/dial/index.d.ts +63 -0
- package/dist/cjs/dial/index.js +134 -0
- package/dist/cjs/dial/index.js.map +1 -0
- package/dist/cjs/dial/origins.d.ts +4 -0
- package/dist/cjs/dial/origins.js +36 -0
- package/dist/cjs/dial/origins.js.map +1 -0
- package/dist/cjs/dial/parse.d.ts +101 -0
- package/dist/cjs/dial/parse.js +296 -0
- package/dist/cjs/dial/parse.js.map +1 -0
- package/dist/cjs/dial/route-provider.d.ts +96 -0
- package/dist/cjs/dial/route-provider.js +376 -0
- package/dist/cjs/dial/route-provider.js.map +1 -0
- package/dist/cjs/dial/ssdp-socket.d.ts +34 -0
- package/dist/cjs/dial/ssdp-socket.js +72 -0
- package/dist/cjs/dial/ssdp-socket.js.map +1 -0
- package/dist/cjs/dial/xml.d.ts +13 -0
- package/dist/cjs/dial/xml.js +208 -0
- package/dist/cjs/dial/xml.js.map +1 -0
- package/dist/cjs/discovery/cast-discovery.d.ts +2 -0
- package/dist/cjs/discovery/cast-discovery.js.map +1 -1
- package/dist/cjs/discovery/device-cache.d.ts +9 -0
- package/dist/cjs/discovery/device-cache.js.map +1 -1
- package/dist/cjs/discovery/index.d.ts +1 -0
- package/dist/cjs/discovery/index.js +1 -0
- package/dist/cjs/discovery/index.js.map +1 -1
- package/dist/cjs/discovery/ip-policy.d.ts +20 -0
- package/dist/cjs/discovery/ip-policy.js +109 -0
- package/dist/cjs/discovery/ip-policy.js.map +1 -0
- package/dist/cjs/discovery/udp-socket.d.ts +3 -0
- package/dist/cjs/discovery/udp-socket.js +3 -0
- package/dist/cjs/discovery/udp-socket.js.map +1 -1
- package/dist/cjs/electron/access-code.d.ts +221 -0
- package/dist/cjs/electron/access-code.js +586 -0
- package/dist/cjs/electron/access-code.js.map +1 -0
- package/dist/cjs/electron/app-discovery.d.ts +82 -0
- package/dist/cjs/electron/app-discovery.js +219 -0
- package/dist/cjs/electron/app-discovery.js.map +1 -0
- package/dist/cjs/electron/default-presentation.d.ts +38 -0
- package/dist/cjs/electron/default-presentation.js +88 -0
- package/dist/cjs/electron/default-presentation.js.map +1 -0
- package/dist/cjs/electron/main.d.ts +98 -11
- package/dist/cjs/electron/main.js +602 -20
- package/dist/cjs/electron/main.js.map +1 -1
- package/dist/cjs/electron/manager-api.d.ts +200 -18
- package/dist/cjs/electron/manager-api.js +199 -4
- package/dist/cjs/electron/manager-api.js.map +1 -1
- package/dist/cjs/electron/media-controller.d.ts +79 -0
- package/dist/cjs/electron/media-controller.js +251 -0
- package/dist/cjs/electron/media-controller.js.map +1 -0
- package/dist/cjs/electron/network-monitor.d.ts +61 -0
- package/dist/cjs/electron/network-monitor.js +124 -0
- package/dist/cjs/electron/network-monitor.js.map +1 -0
- package/dist/cjs/electron/preload.js.map +1 -1
- package/dist/cjs/electron/presentation-handler.d.ts +39 -4
- package/dist/cjs/electron/presentation-handler.js +191 -47
- package/dist/cjs/electron/presentation-handler.js.map +1 -1
- package/dist/cjs/electron/presentation-source.d.ts +76 -0
- package/dist/cjs/electron/presentation-source.js +132 -0
- package/dist/cjs/electron/presentation-source.js.map +1 -0
- package/dist/cjs/electron/session-service.d.ts +198 -24
- package/dist/cjs/electron/session-service.js +630 -248
- package/dist/cjs/electron/session-service.js.map +1 -1
- package/dist/cjs/electron/session-tracker.d.ts +82 -0
- package/dist/cjs/electron/session-tracker.js +225 -0
- package/dist/cjs/electron/session-tracker.js.map +1 -0
- package/dist/cjs/electron/sink-service.d.ts +246 -0
- package/dist/cjs/electron/sink-service.js +606 -0
- package/dist/cjs/electron/sink-service.js.map +1 -0
- package/dist/cjs/electron/wired-display/controller.d.ts +76 -0
- package/dist/cjs/electron/wired-display/controller.js +198 -0
- package/dist/cjs/electron/wired-display/controller.js.map +1 -0
- package/dist/cjs/electron/wired-display/displays.d.ts +44 -0
- package/dist/cjs/electron/wired-display/displays.js +98 -0
- package/dist/cjs/electron/wired-display/displays.js.map +1 -0
- package/dist/cjs/electron/wired-display/electron-windows.d.ts +111 -0
- package/dist/cjs/electron/wired-display/electron-windows.js +306 -0
- package/dist/cjs/electron/wired-display/electron-windows.js.map +1 -0
- package/dist/cjs/electron/wired-display/index.d.ts +90 -0
- package/dist/cjs/electron/wired-display/index.js +115 -0
- package/dist/cjs/electron/wired-display/index.js.map +1 -0
- package/dist/cjs/electron/wired-display/local-presentation.d.ts +98 -0
- package/dist/cjs/electron/wired-display/local-presentation.js +234 -0
- package/dist/cjs/electron/wired-display/local-presentation.js.map +1 -0
- package/dist/cjs/electron/wired-display/provider.d.ts +112 -0
- package/dist/cjs/electron/wired-display/provider.js +202 -0
- package/dist/cjs/electron/wired-display/provider.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mirroring/backend.d.ts +76 -0
- package/dist/cjs/mirroring/backend.js +21 -0
- package/dist/cjs/mirroring/backend.js.map +1 -0
- package/dist/cjs/mirroring/electron/agent-protocol.d.ts +158 -0
- package/dist/cjs/mirroring/electron/agent-protocol.js +11 -0
- package/dist/cjs/mirroring/electron/agent-protocol.js.map +1 -0
- package/dist/cjs/mirroring/electron/agent-source.d.ts +20 -0
- package/dist/cjs/mirroring/electron/agent-source.js +621 -0
- package/dist/cjs/mirroring/electron/agent-source.js.map +1 -0
- package/dist/cjs/mirroring/electron/engine-process.d.ts +87 -0
- package/dist/cjs/mirroring/electron/engine-process.js +81 -0
- package/dist/cjs/mirroring/electron/engine-process.js.map +1 -0
- package/dist/cjs/mirroring/electron/host.d.ts +89 -0
- package/dist/cjs/mirroring/electron/host.js +321 -0
- package/dist/cjs/mirroring/electron/host.js.map +1 -0
- package/dist/cjs/mirroring/electron/port-backend.d.ts +107 -0
- package/dist/cjs/mirroring/electron/port-backend.js +446 -0
- package/dist/cjs/mirroring/electron/port-backend.js.map +1 -0
- package/dist/cjs/mirroring/encoding-support.d.ts +66 -0
- package/dist/cjs/mirroring/encoding-support.js +89 -0
- package/dist/cjs/mirroring/encoding-support.js.map +1 -0
- package/dist/cjs/mirroring/engine.d.ts +16 -0
- package/dist/cjs/mirroring/engine.js +78 -0
- package/dist/cjs/mirroring/engine.js.map +1 -0
- package/dist/cjs/mirroring/mirror-settings.d.ts +101 -0
- package/dist/cjs/mirroring/mirror-settings.js +140 -0
- package/dist/cjs/mirroring/mirror-settings.js.map +1 -0
- package/dist/cjs/mirroring/mirroring-activity.d.ts +207 -0
- package/dist/cjs/mirroring/mirroring-activity.js +367 -0
- package/dist/cjs/mirroring/mirroring-activity.js.map +1 -0
- package/dist/cjs/mirroring/mirroring-manager.d.ts +134 -0
- package/dist/cjs/mirroring/mirroring-manager.js +286 -0
- package/dist/cjs/mirroring/mirroring-manager.js.map +1 -0
- package/dist/cjs/mirroring/protocol/answer.d.ts +87 -0
- package/dist/cjs/mirroring/protocol/answer.js +233 -0
- package/dist/cjs/mirroring/protocol/answer.js.map +1 -0
- package/dist/cjs/mirroring/protocol/constants.d.ts +64 -0
- package/dist/cjs/mirroring/protocol/constants.js +70 -0
- package/dist/cjs/mirroring/protocol/constants.js.map +1 -0
- package/dist/cjs/mirroring/protocol/errors.d.ts +25 -0
- package/dist/cjs/mirroring/protocol/errors.js +34 -0
- package/dist/cjs/mirroring/protocol/errors.js.map +1 -0
- package/dist/cjs/mirroring/protocol/frame-id.d.ts +9 -0
- package/dist/cjs/mirroring/protocol/frame-id.js +24 -0
- package/dist/cjs/mirroring/protocol/frame-id.js.map +1 -0
- package/dist/cjs/mirroring/protocol/messenger.d.ts +42 -0
- package/dist/cjs/mirroring/protocol/messenger.js +122 -0
- package/dist/cjs/mirroring/protocol/messenger.js.map +1 -0
- package/dist/cjs/mirroring/protocol/offer.d.ts +109 -0
- package/dist/cjs/mirroring/protocol/offer.js +192 -0
- package/dist/cjs/mirroring/protocol/offer.js.map +1 -0
- package/dist/cjs/mirroring/protocol/recommendations.d.ts +28 -0
- package/dist/cjs/mirroring/protocol/recommendations.js +103 -0
- package/dist/cjs/mirroring/protocol/recommendations.js.map +1 -0
- package/dist/cjs/mirroring/routing.d.ts +60 -0
- package/dist/cjs/mirroring/routing.js +147 -0
- package/dist/cjs/mirroring/routing.js.map +1 -0
- package/dist/cjs/mirroring/rtcp/ntp.d.ts +27 -0
- package/dist/cjs/mirroring/rtcp/ntp.js +62 -0
- package/dist/cjs/mirroring/rtcp/ntp.js.map +1 -0
- package/dist/cjs/mirroring/rtcp/parser.d.ts +50 -0
- package/dist/cjs/mirroring/rtcp/parser.js +270 -0
- package/dist/cjs/mirroring/rtcp/parser.js.map +1 -0
- package/dist/cjs/mirroring/rtcp/sender-report.d.ts +32 -0
- package/dist/cjs/mirroring/rtcp/sender-report.js +56 -0
- package/dist/cjs/mirroring/rtcp/sender-report.js.map +1 -0
- package/dist/cjs/mirroring/rtcp/wire.d.ts +54 -0
- package/dist/cjs/mirroring/rtcp/wire.js +73 -0
- package/dist/cjs/mirroring/rtcp/wire.js.map +1 -0
- package/dist/cjs/mirroring/rtp/frame-crypto.d.ts +11 -0
- package/dist/cjs/mirroring/rtp/frame-crypto.js +39 -0
- package/dist/cjs/mirroring/rtp/frame-crypto.js.map +1 -0
- package/dist/cjs/mirroring/rtp/frame.d.ts +23 -0
- package/dist/cjs/mirroring/rtp/frame.js +3 -0
- package/dist/cjs/mirroring/rtp/frame.js.map +1 -0
- package/dist/cjs/mirroring/rtp/packetizer.d.ts +27 -0
- package/dist/cjs/mirroring/rtp/packetizer.js +92 -0
- package/dist/cjs/mirroring/rtp/packetizer.js.map +1 -0
- package/dist/cjs/mirroring/sender/audio-sender.d.ts +23 -0
- package/dist/cjs/mirroring/sender/audio-sender.js +52 -0
- package/dist/cjs/mirroring/sender/audio-sender.js.map +1 -0
- package/dist/cjs/mirroring/sender/bandwidth-estimator.d.ts +26 -0
- package/dist/cjs/mirroring/sender/bandwidth-estimator.js +107 -0
- package/dist/cjs/mirroring/sender/bandwidth-estimator.js.map +1 -0
- package/dist/cjs/mirroring/sender/capture-size-oracle.d.ts +121 -0
- package/dist/cjs/mirroring/sender/capture-size-oracle.js +440 -0
- package/dist/cjs/mirroring/sender/capture-size-oracle.js.map +1 -0
- package/dist/cjs/mirroring/sender/frame-sender.d.ts +103 -0
- package/dist/cjs/mirroring/sender/frame-sender.js +217 -0
- package/dist/cjs/mirroring/sender/frame-sender.js.map +1 -0
- package/dist/cjs/mirroring/sender/packet-router.d.ts +74 -0
- package/dist/cjs/mirroring/sender/packet-router.js +196 -0
- package/dist/cjs/mirroring/sender/packet-router.js.map +1 -0
- package/dist/cjs/mirroring/sender/sender-session.d.ts +85 -0
- package/dist/cjs/mirroring/sender/sender-session.js +240 -0
- package/dist/cjs/mirroring/sender/sender-session.js.map +1 -0
- package/dist/cjs/mirroring/sender/sender.d.ts +120 -0
- package/dist/cjs/mirroring/sender/sender.js +457 -0
- package/dist/cjs/mirroring/sender/sender.js.map +1 -0
- package/dist/cjs/mirroring/sender/video-encoder-metrics.d.ts +29 -0
- package/dist/cjs/mirroring/sender/video-encoder-metrics.js +64 -0
- package/dist/cjs/mirroring/sender/video-encoder-metrics.js.map +1 -0
- package/dist/cjs/mirroring/sender/video-sender.d.ts +95 -0
- package/dist/cjs/mirroring/sender/video-sender.js +183 -0
- package/dist/cjs/mirroring/sender/video-sender.js.map +1 -0
- package/dist/cjs/mirroring/session-host.d.ts +185 -0
- package/dist/cjs/mirroring/session-host.js +630 -0
- package/dist/cjs/mirroring/session-host.js.map +1 -0
- package/dist/cjs/mirroring/stats/clock-offset-estimator.d.ts +11 -0
- package/dist/cjs/mirroring/stats/clock-offset-estimator.js +123 -0
- package/dist/cjs/mirroring/stats/clock-offset-estimator.js.map +1 -0
- package/dist/cjs/mirroring/stats/openscreen-stats-client.d.ts +12 -0
- package/dist/cjs/mirroring/stats/openscreen-stats-client.js +21 -0
- package/dist/cjs/mirroring/stats/openscreen-stats-client.js.map +1 -0
- package/dist/cjs/mirroring/stats/sorted-map.d.ts +23 -0
- package/dist/cjs/mirroring/stats/sorted-map.js +70 -0
- package/dist/cjs/mirroring/stats/sorted-map.js.map +1 -0
- package/dist/cjs/mirroring/stats/statistics-analyzer.d.ts +50 -0
- package/dist/cjs/mirroring/stats/statistics-analyzer.js +339 -0
- package/dist/cjs/mirroring/stats/statistics-analyzer.js.map +1 -0
- package/dist/cjs/mirroring/stats/statistics-collector.d.ts +29 -0
- package/dist/cjs/mirroring/stats/statistics-collector.js +53 -0
- package/dist/cjs/mirroring/stats/statistics-collector.js.map +1 -0
- package/dist/cjs/mirroring/stats/statistics-common.d.ts +61 -0
- package/dist/cjs/mirroring/stats/statistics-common.js +45 -0
- package/dist/cjs/mirroring/stats/statistics-common.js.map +1 -0
- package/dist/cjs/mirroring/stats/statistics-dispatcher.d.ts +28 -0
- package/dist/cjs/mirroring/stats/statistics-dispatcher.js +104 -0
- package/dist/cjs/mirroring/stats/statistics-dispatcher.js.map +1 -0
- package/dist/cjs/mirroring/stats/statistics.d.ts +84 -0
- package/dist/cjs/mirroring/stats/statistics.js +147 -0
- package/dist/cjs/mirroring/stats/statistics.js.map +1 -0
- package/dist/cjs/mirroring/transport/udp-environment.d.ts +40 -0
- package/dist/cjs/mirroring/transport/udp-environment.js +97 -0
- package/dist/cjs/mirroring/transport/udp-environment.js.map +1 -0
- package/dist/cjs/polyfill/bridge-types.d.ts +11 -0
- package/dist/cjs/polyfill/presentation-receiver.d.ts +12 -0
- package/dist/cjs/polyfill/presentation-receiver.js +369 -0
- package/dist/cjs/polyfill/presentation-receiver.js.map +1 -0
- package/dist/cjs/polyfill/presentation-standin.js +157 -15
- package/dist/cjs/polyfill/presentation-standin.js.map +1 -1
- package/dist/cjs/protocol/framing.d.ts +1 -1
- package/dist/cjs/protocol/framing.js +1 -1
- package/dist/cjs/protocol/framing.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +56 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/auth/build-time.js +1 -1
- package/dist/client/auth/cast-auth.d.ts +2 -0
- package/dist/client/auth/cast-auth.js.map +1 -1
- package/dist/dial/dial-registry.d.ts +104 -0
- package/dist/dial/dial-registry.js +297 -0
- package/dist/dial/dial-registry.js.map +1 -0
- package/dist/dial/dial-sink-service.d.ts +108 -0
- package/dist/dial/dial-sink-service.js +310 -0
- package/dist/dial/dial-sink-service.js.map +1 -0
- package/dist/dial/http.d.ts +40 -0
- package/dist/dial/http.js +165 -0
- package/dist/dial/http.js.map +1 -0
- package/dist/dial/index.d.ts +63 -0
- package/dist/dial/index.js +115 -0
- package/dist/dial/index.js.map +1 -0
- package/dist/dial/origins.d.ts +4 -0
- package/dist/dial/origins.js +32 -0
- package/dist/dial/origins.js.map +1 -0
- package/dist/dial/parse.d.ts +101 -0
- package/dist/dial/parse.js +281 -0
- package/dist/dial/parse.js.map +1 -0
- package/dist/dial/route-provider.d.ts +96 -0
- package/dist/dial/route-provider.js +369 -0
- package/dist/dial/route-provider.js.map +1 -0
- package/dist/dial/ssdp-socket.d.ts +34 -0
- package/dist/dial/ssdp-socket.js +65 -0
- package/dist/dial/ssdp-socket.js.map +1 -0
- package/dist/dial/xml.d.ts +13 -0
- package/dist/dial/xml.js +204 -0
- package/dist/dial/xml.js.map +1 -0
- package/dist/dial-test/cli-main.d.ts +17 -0
- package/dist/dial-test/cli-main.js +130 -0
- package/dist/dial-test/cli-main.js.map +1 -0
- package/dist/dial-test/report.d.ts +55 -0
- package/dist/dial-test/report.js +77 -0
- package/dist/dial-test/report.js.map +1 -0
- package/dist/dial-test/runner.d.ts +42 -0
- package/dist/dial-test/runner.js +566 -0
- package/dist/dial-test/runner.js.map +1 -0
- package/dist/dial-test/scrub.d.ts +14 -0
- package/dist/dial-test/scrub.js +73 -0
- package/dist/dial-test/scrub.js.map +1 -0
- package/dist/discovery/cast-discovery.d.ts +2 -0
- package/dist/discovery/cast-discovery.js.map +1 -1
- package/dist/discovery/device-cache.d.ts +9 -0
- package/dist/discovery/device-cache.js.map +1 -1
- package/dist/discovery/index.d.ts +1 -0
- package/dist/discovery/index.js +1 -0
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/ip-policy.d.ts +20 -0
- package/dist/discovery/ip-policy.js +103 -0
- package/dist/discovery/ip-policy.js.map +1 -0
- package/dist/discovery/udp-socket.d.ts +3 -0
- package/dist/discovery/udp-socket.js +3 -0
- package/dist/discovery/udp-socket.js.map +1 -1
- package/dist/electron/access-code.d.ts +221 -0
- package/dist/electron/access-code.js +577 -0
- package/dist/electron/access-code.js.map +1 -0
- package/dist/electron/app-discovery.d.ts +82 -0
- package/dist/electron/app-discovery.js +215 -0
- package/dist/electron/app-discovery.js.map +1 -0
- package/dist/electron/default-presentation.d.ts +38 -0
- package/dist/electron/default-presentation.js +83 -0
- package/dist/electron/default-presentation.js.map +1 -0
- package/dist/electron/main.d.ts +98 -11
- package/dist/electron/main.js +597 -21
- package/dist/electron/main.js.map +1 -1
- package/dist/electron/manager-api.d.ts +200 -18
- package/dist/electron/manager-api.js +196 -4
- package/dist/electron/manager-api.js.map +1 -1
- package/dist/electron/media-controller.d.ts +79 -0
- package/dist/electron/media-controller.js +248 -0
- package/dist/electron/media-controller.js.map +1 -0
- package/dist/electron/network-monitor.d.ts +61 -0
- package/dist/electron/network-monitor.js +117 -0
- package/dist/electron/network-monitor.js.map +1 -0
- package/dist/electron/preload.js.map +1 -1
- package/dist/electron/presentation-handler.d.ts +39 -4
- package/dist/electron/presentation-handler.js +192 -48
- package/dist/electron/presentation-handler.js.map +1 -1
- package/dist/electron/presentation-source.d.ts +76 -0
- package/dist/electron/presentation-source.js +125 -0
- package/dist/electron/presentation-source.js.map +1 -0
- package/dist/electron/session-service.d.ts +198 -24
- package/dist/electron/session-service.js +629 -248
- package/dist/electron/session-service.js.map +1 -1
- package/dist/electron/session-tracker.d.ts +82 -0
- package/dist/electron/session-tracker.js +219 -0
- package/dist/electron/session-tracker.js.map +1 -0
- package/dist/electron/sink-service.d.ts +246 -0
- package/dist/electron/sink-service.js +602 -0
- package/dist/electron/sink-service.js.map +1 -0
- package/dist/electron/wired-display/controller.d.ts +76 -0
- package/dist/electron/wired-display/controller.js +194 -0
- package/dist/electron/wired-display/controller.js.map +1 -0
- package/dist/electron/wired-display/displays.d.ts +44 -0
- package/dist/electron/wired-display/displays.js +91 -0
- package/dist/electron/wired-display/displays.js.map +1 -0
- package/dist/electron/wired-display/electron-windows.d.ts +111 -0
- package/dist/electron/wired-display/electron-windows.js +301 -0
- package/dist/electron/wired-display/electron-windows.js.map +1 -0
- package/dist/electron/wired-display/index.d.ts +90 -0
- package/dist/electron/wired-display/index.js +99 -0
- package/dist/electron/wired-display/index.js.map +1 -0
- package/dist/electron/wired-display/local-presentation.d.ts +98 -0
- package/dist/electron/wired-display/local-presentation.js +228 -0
- package/dist/electron/wired-display/local-presentation.js.map +1 -0
- package/dist/electron/wired-display/provider.d.ts +112 -0
- package/dist/electron/wired-display/provider.js +197 -0
- package/dist/electron/wired-display/provider.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mirroring/backend.d.ts +76 -0
- package/dist/mirroring/backend.js +18 -0
- package/dist/mirroring/backend.js.map +1 -0
- package/dist/mirroring/electron/agent-protocol.d.ts +158 -0
- package/dist/mirroring/electron/agent-protocol.js +10 -0
- package/dist/mirroring/electron/agent-protocol.js.map +1 -0
- package/dist/mirroring/electron/agent-source.d.ts +20 -0
- package/dist/mirroring/electron/agent-source.js +618 -0
- package/dist/mirroring/electron/agent-source.js.map +1 -0
- package/dist/mirroring/electron/engine-process.d.ts +87 -0
- package/dist/mirroring/electron/engine-process.js +78 -0
- package/dist/mirroring/electron/engine-process.js.map +1 -0
- package/dist/mirroring/electron/host.d.ts +89 -0
- package/dist/mirroring/electron/host.js +318 -0
- package/dist/mirroring/electron/host.js.map +1 -0
- package/dist/mirroring/electron/port-backend.d.ts +107 -0
- package/dist/mirroring/electron/port-backend.js +441 -0
- package/dist/mirroring/electron/port-backend.js.map +1 -0
- package/dist/mirroring/encoding-support.d.ts +66 -0
- package/dist/mirroring/encoding-support.js +81 -0
- package/dist/mirroring/encoding-support.js.map +1 -0
- package/dist/mirroring/engine.d.ts +16 -0
- package/dist/mirroring/engine.js +75 -0
- package/dist/mirroring/engine.js.map +1 -0
- package/dist/mirroring/mirror-settings.d.ts +101 -0
- package/dist/mirroring/mirror-settings.js +134 -0
- package/dist/mirroring/mirror-settings.js.map +1 -0
- package/dist/mirroring/mirroring-activity.d.ts +207 -0
- package/dist/mirroring/mirroring-activity.js +362 -0
- package/dist/mirroring/mirroring-activity.js.map +1 -0
- package/dist/mirroring/mirroring-manager.d.ts +134 -0
- package/dist/mirroring/mirroring-manager.js +281 -0
- package/dist/mirroring/mirroring-manager.js.map +1 -0
- package/dist/mirroring/protocol/answer.d.ts +87 -0
- package/dist/mirroring/protocol/answer.js +226 -0
- package/dist/mirroring/protocol/answer.js.map +1 -0
- package/dist/mirroring/protocol/constants.d.ts +64 -0
- package/dist/mirroring/protocol/constants.js +66 -0
- package/dist/mirroring/protocol/constants.js.map +1 -0
- package/dist/mirroring/protocol/errors.d.ts +25 -0
- package/dist/mirroring/protocol/errors.js +29 -0
- package/dist/mirroring/protocol/errors.js.map +1 -0
- package/dist/mirroring/protocol/frame-id.d.ts +9 -0
- package/dist/mirroring/protocol/frame-id.js +20 -0
- package/dist/mirroring/protocol/frame-id.js.map +1 -0
- package/dist/mirroring/protocol/messenger.d.ts +42 -0
- package/dist/mirroring/protocol/messenger.js +118 -0
- package/dist/mirroring/protocol/messenger.js.map +1 -0
- package/dist/mirroring/protocol/offer.d.ts +109 -0
- package/dist/mirroring/protocol/offer.js +176 -0
- package/dist/mirroring/protocol/offer.js.map +1 -0
- package/dist/mirroring/protocol/recommendations.d.ts +28 -0
- package/dist/mirroring/protocol/recommendations.js +99 -0
- package/dist/mirroring/protocol/recommendations.js.map +1 -0
- package/dist/mirroring/routing.d.ts +60 -0
- package/dist/mirroring/routing.js +130 -0
- package/dist/mirroring/routing.js.map +1 -0
- package/dist/mirroring/rtcp/ntp.d.ts +27 -0
- package/dist/mirroring/rtcp/ntp.js +57 -0
- package/dist/mirroring/rtcp/ntp.js.map +1 -0
- package/dist/mirroring/rtcp/parser.d.ts +50 -0
- package/dist/mirroring/rtcp/parser.js +265 -0
- package/dist/mirroring/rtcp/parser.js.map +1 -0
- package/dist/mirroring/rtcp/sender-report.d.ts +32 -0
- package/dist/mirroring/rtcp/sender-report.js +51 -0
- package/dist/mirroring/rtcp/sender-report.js.map +1 -0
- package/dist/mirroring/rtcp/wire.d.ts +54 -0
- package/dist/mirroring/rtcp/wire.js +68 -0
- package/dist/mirroring/rtcp/wire.js.map +1 -0
- package/dist/mirroring/rtp/frame-crypto.d.ts +11 -0
- package/dist/mirroring/rtp/frame-crypto.js +35 -0
- package/dist/mirroring/rtp/frame-crypto.js.map +1 -0
- package/dist/mirroring/rtp/frame.d.ts +23 -0
- package/dist/mirroring/rtp/frame.js +2 -0
- package/dist/mirroring/rtp/frame.js.map +1 -0
- package/dist/mirroring/rtp/packetizer.d.ts +27 -0
- package/dist/mirroring/rtp/packetizer.js +88 -0
- package/dist/mirroring/rtp/packetizer.js.map +1 -0
- package/dist/mirroring/sender/audio-sender.d.ts +23 -0
- package/dist/mirroring/sender/audio-sender.js +54 -0
- package/dist/mirroring/sender/audio-sender.js.map +1 -0
- package/dist/mirroring/sender/bandwidth-estimator.d.ts +26 -0
- package/dist/mirroring/sender/bandwidth-estimator.js +103 -0
- package/dist/mirroring/sender/bandwidth-estimator.js.map +1 -0
- package/dist/mirroring/sender/capture-size-oracle.d.ts +121 -0
- package/dist/mirroring/sender/capture-size-oracle.js +433 -0
- package/dist/mirroring/sender/capture-size-oracle.js.map +1 -0
- package/dist/mirroring/sender/frame-sender.d.ts +103 -0
- package/dist/mirroring/sender/frame-sender.js +212 -0
- package/dist/mirroring/sender/frame-sender.js.map +1 -0
- package/dist/mirroring/sender/packet-router.d.ts +74 -0
- package/dist/mirroring/sender/packet-router.js +191 -0
- package/dist/mirroring/sender/packet-router.js.map +1 -0
- package/dist/mirroring/sender/sender-session.d.ts +85 -0
- package/dist/mirroring/sender/sender-session.js +235 -0
- package/dist/mirroring/sender/sender-session.js.map +1 -0
- package/dist/mirroring/sender/sender.d.ts +120 -0
- package/dist/mirroring/sender/sender.js +452 -0
- package/dist/mirroring/sender/sender.js.map +1 -0
- package/dist/mirroring/sender/video-encoder-metrics.d.ts +29 -0
- package/dist/mirroring/sender/video-encoder-metrics.js +58 -0
- package/dist/mirroring/sender/video-encoder-metrics.js.map +1 -0
- package/dist/mirroring/sender/video-sender.d.ts +95 -0
- package/dist/mirroring/sender/video-sender.js +190 -0
- package/dist/mirroring/sender/video-sender.js.map +1 -0
- package/dist/mirroring/session-host.d.ts +185 -0
- package/dist/mirroring/session-host.js +625 -0
- package/dist/mirroring/session-host.js.map +1 -0
- package/dist/mirroring/stats/clock-offset-estimator.d.ts +11 -0
- package/dist/mirroring/stats/clock-offset-estimator.js +120 -0
- package/dist/mirroring/stats/clock-offset-estimator.js.map +1 -0
- package/dist/mirroring/stats/openscreen-stats-client.d.ts +12 -0
- package/dist/mirroring/stats/openscreen-stats-client.js +17 -0
- package/dist/mirroring/stats/openscreen-stats-client.js.map +1 -0
- package/dist/mirroring/stats/sorted-map.d.ts +23 -0
- package/dist/mirroring/stats/sorted-map.js +66 -0
- package/dist/mirroring/stats/sorted-map.js.map +1 -0
- package/dist/mirroring/stats/statistics-analyzer.d.ts +50 -0
- package/dist/mirroring/stats/statistics-analyzer.js +335 -0
- package/dist/mirroring/stats/statistics-analyzer.js.map +1 -0
- package/dist/mirroring/stats/statistics-collector.d.ts +29 -0
- package/dist/mirroring/stats/statistics-collector.js +49 -0
- package/dist/mirroring/stats/statistics-collector.js.map +1 -0
- package/dist/mirroring/stats/statistics-common.d.ts +61 -0
- package/dist/mirroring/stats/statistics-common.js +39 -0
- package/dist/mirroring/stats/statistics-common.js.map +1 -0
- package/dist/mirroring/stats/statistics-dispatcher.d.ts +28 -0
- package/dist/mirroring/stats/statistics-dispatcher.js +100 -0
- package/dist/mirroring/stats/statistics-dispatcher.js.map +1 -0
- package/dist/mirroring/stats/statistics.d.ts +84 -0
- package/dist/mirroring/stats/statistics.js +141 -0
- package/dist/mirroring/stats/statistics.js.map +1 -0
- package/dist/mirroring/transport/udp-environment.d.ts +40 -0
- package/dist/mirroring/transport/udp-environment.js +93 -0
- package/dist/mirroring/transport/udp-environment.js.map +1 -0
- package/dist/polyfill/bridge-types.d.ts +11 -0
- package/dist/polyfill/presentation-receiver.d.ts +12 -0
- package/dist/polyfill/presentation-receiver.js +366 -0
- package/dist/polyfill/presentation-receiver.js.map +1 -0
- package/dist/polyfill/presentation-standin.js +157 -15
- package/dist/polyfill/presentation-standin.js.map +1 -1
- package/dist/protocol/framing.d.ts +1 -1
- package/dist/protocol/framing.js +1 -1
- package/dist/protocol/framing.js.map +1 -1
- package/docs/API.md +724 -0
- package/docs/ARCHITECTURE.md +242 -0
- package/docs/CHROMIUM-MAP.md +176 -0
- package/docs/DESIGN.md +1189 -0
- package/docs/FAQ.md +123 -0
- package/docs/GETTING-STARTED.md +248 -0
- package/docs/MAIN-API.md +524 -0
- package/docs/TROUBLESHOOTING.md +283 -0
- package/docs/guides/audio-and-groups.md +75 -0
- package/docs/guides/custom-receivers.md +109 -0
- package/docs/guides/device-authentication.md +145 -0
- package/docs/guides/device-picker.md +176 -0
- package/docs/guides/index.md +17 -0
- package/docs/guides/low-level-client.md +103 -0
- package/docs/guides/restart-rejoin.md +172 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/windows-and-iframes.md +116 -0
- package/docs/readme/badges/dependencies.svg +1 -0
- package/docs/readme/badges/electron.svg +1 -0
- package/docs/readme/badges/license.svg +1 -0
- package/docs/readme/badges/node.svg +1 -0
- package/docs/readme/board.jpg +0 -0
- package/docs/readme/hero-dark.jpg +0 -0
- package/docs/readme/hero-light.jpg +0 -0
- package/docs/readme/nosignal.jpg +0 -0
- package/docs/readme/parity.jpg +0 -0
- package/docs/readme/trace.svg +22 -0
- package/package.json +21 -5
- package/src/cli.ts +57 -0
- package/src/client/auth/cast-auth.ts +2 -0
- package/src/dial/dial-registry.ts +316 -0
- package/src/dial/dial-sink-service.ts +343 -0
- package/src/dial/http.ts +200 -0
- package/src/dial/index.ts +135 -0
- package/src/dial/origins.ts +31 -0
- package/src/dial/parse.ts +319 -0
- package/src/dial/route-provider.ts +429 -0
- package/src/dial/ssdp-socket.ts +79 -0
- package/src/dial/xml.ts +180 -0
- package/src/dial-test/cli-main.ts +146 -0
- package/src/dial-test/report.ts +109 -0
- package/src/dial-test/runner.ts +615 -0
- package/src/dial-test/scrub.ts +74 -0
- package/src/discovery/cast-discovery.ts +2 -0
- package/src/discovery/device-cache.ts +5 -0
- package/src/discovery/index.ts +1 -0
- package/src/discovery/ip-policy.ts +97 -0
- package/src/discovery/udp-socket.ts +3 -0
- package/src/electron/access-code.ts +681 -0
- package/src/electron/app-discovery.ts +244 -0
- package/src/electron/default-presentation.ts +104 -0
- package/src/electron/main.ts +664 -29
- package/src/electron/manager-api.ts +367 -15
- package/src/electron/media-controller.ts +313 -0
- package/src/electron/network-monitor.ts +140 -0
- package/src/electron/preload.ts +1 -1
- package/src/electron/presentation-handler.ts +195 -48
- package/src/electron/presentation-source.ts +155 -0
- package/src/electron/session-service.ts +693 -238
- package/src/electron/session-tracker.ts +248 -0
- package/src/electron/sink-service.ts +726 -0
- package/src/electron/wired-display/controller.ts +212 -0
- package/src/electron/wired-display/displays.ts +107 -0
- package/src/electron/wired-display/electron-windows.ts +386 -0
- package/src/electron/wired-display/index.ts +181 -0
- package/src/electron/wired-display/local-presentation.ts +286 -0
- package/src/electron/wired-display/provider.ts +276 -0
- package/src/index.ts +1 -0
- package/src/mirroring/backend.ts +103 -0
- package/src/mirroring/electron/agent-protocol.ts +84 -0
- package/src/mirroring/electron/agent-source.ts +619 -0
- package/src/mirroring/electron/engine-process.ts +131 -0
- package/src/mirroring/electron/host.ts +361 -0
- package/src/mirroring/electron/port-backend.ts +466 -0
- package/src/mirroring/encoding-support.ts +146 -0
- package/src/mirroring/engine.ts +91 -0
- package/src/mirroring/mirror-settings.ts +174 -0
- package/src/mirroring/mirroring-activity.ts +466 -0
- package/src/mirroring/mirroring-manager.ts +342 -0
- package/src/mirroring/protocol/answer.ts +285 -0
- package/src/mirroring/protocol/constants.ts +75 -0
- package/src/mirroring/protocol/errors.ts +36 -0
- package/src/mirroring/protocol/frame-id.ts +20 -0
- package/src/mirroring/protocol/messenger.ts +128 -0
- package/src/mirroring/protocol/offer.ts +275 -0
- package/src/mirroring/protocol/recommendations.ts +135 -0
- package/src/mirroring/routing.ts +160 -0
- package/src/mirroring/rtcp/ntp.ts +61 -0
- package/src/mirroring/rtcp/parser.ts +292 -0
- package/src/mirroring/rtcp/sender-report.ts +88 -0
- package/src/mirroring/rtcp/wire.ts +76 -0
- package/src/mirroring/rtp/frame-crypto.ts +38 -0
- package/src/mirroring/rtp/frame.ts +25 -0
- package/src/mirroring/rtp/packetizer.ts +95 -0
- package/src/mirroring/sender/audio-sender.ts +59 -0
- package/src/mirroring/sender/bandwidth-estimator.ts +111 -0
- package/src/mirroring/sender/capture-size-oracle.ts +476 -0
- package/src/mirroring/sender/frame-sender.ts +293 -0
- package/src/mirroring/sender/packet-router.ts +228 -0
- package/src/mirroring/sender/sender-session.ts +306 -0
- package/src/mirroring/sender/sender.ts +497 -0
- package/src/mirroring/sender/video-encoder-metrics.ts +64 -0
- package/src/mirroring/sender/video-sender.ts +243 -0
- package/src/mirroring/session-host.ts +725 -0
- package/src/mirroring/stats/clock-offset-estimator.ts +139 -0
- package/src/mirroring/stats/openscreen-stats-client.ts +19 -0
- package/src/mirroring/stats/sorted-map.ts +68 -0
- package/src/mirroring/stats/statistics-analyzer.ts +388 -0
- package/src/mirroring/stats/statistics-collector.ts +69 -0
- package/src/mirroring/stats/statistics-common.ts +112 -0
- package/src/mirroring/stats/statistics-dispatcher.ts +133 -0
- package/src/mirroring/stats/statistics.ts +170 -0
- package/src/mirroring/transport/udp-environment.ts +100 -0
- package/src/polyfill/bridge-types.ts +11 -0
- package/src/polyfill/presentation-receiver.ts +350 -0
- package/src/polyfill/presentation-standin.ts +147 -15
- package/src/protocol/framing.ts +1 -1
package/SECURITY.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
This document describes what electron-cast trusts, what it checks, and what it leaves to the app. It reflects
|
|
4
|
+
v0.4.0. To report a vulnerability, see [Reporting a vulnerability](#reporting-a-vulnerability).
|
|
5
|
+
|
|
6
|
+
## Threat model
|
|
7
|
+
|
|
8
|
+
electron-cast lets web pages in your Electron windows talk to Cast devices on the local network. Three parties are
|
|
9
|
+
involved:
|
|
10
|
+
|
|
11
|
+
| Party | Trust |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Your main process and preload | Trusted. electron-cast runs there. |
|
|
14
|
+
| The page in the window | Not trusted. It may be a third-party site, or a trusted site that has been compromised, or include third-party scripts. It can run any JavaScript in its own world. |
|
|
15
|
+
| Devices and everything else on the local network | Not trusted. Anyone on the same network segment can answer discovery queries, impersonate a device, or read unencrypted traffic. |
|
|
16
|
+
|
|
17
|
+
What the library tries to guarantee:
|
|
18
|
+
|
|
19
|
+
- A page can only use the narrow bridge the preload exposes. It never gets Node, sockets, `ipcRenderer` or an IPC
|
|
20
|
+
handle. It works with `sandbox: true` and `contextIsolation: true`.
|
|
21
|
+
- A page cannot choose which device, host or port to connect to. The main process opens channels only to devices
|
|
22
|
+
discovery found (at addresses Chrome would accept), and a page casts only to a device the app's `selectDevice`
|
|
23
|
+
returned (or the app's own `startCasting` named).
|
|
24
|
+
- A page cannot see or touch another origin's sessions, except that, as in Chrome, a page that already knows a session
|
|
25
|
+
id can rejoin that session (see [Scoping of sessions and messages](#scoping-of-sessions-and-messages)).
|
|
26
|
+
- A device is used only after it proves it is a genuine Google-certified Cast device (on by default; see
|
|
27
|
+
[TLS and device authentication](#tls-and-device-authentication)).
|
|
28
|
+
- Malformed input from the page, a device, or the network is rejected without crashing the main process.
|
|
29
|
+
|
|
30
|
+
What it does not defend against: a compromised main process or preload, a compromised renderer process (see
|
|
31
|
+
[User gesture](#user-gesture)), an app that auto-approves every request in `selectDevice`, and, when device
|
|
32
|
+
verification is turned off, an attacker on the local network who can impersonate a device (see
|
|
33
|
+
[TLS and device authentication](#tls-and-device-authentication)).
|
|
34
|
+
|
|
35
|
+
## What crosses the IPC boundary
|
|
36
|
+
|
|
37
|
+
The preload exposes one bridge object to the page's main world, and the page can call it directly. Nothing the page
|
|
38
|
+
sends is trusted: every call is validated in the main process, in `src/electron/main.ts`,
|
|
39
|
+
`src/electron/session-service.ts` and `src/electron/presentation-handler.ts`.
|
|
40
|
+
|
|
41
|
+
Channels, with the default channel name `electron-cast`:
|
|
42
|
+
|
|
43
|
+
| Channel | Direction | Used by |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `electron-cast:presentation` (invoke) | page to main | Default mode: `getAvailability`, `stopWatching`, `start`, `reconnect`, `close`, `terminate`. `reconnect` is how a page rejoins a session by id, after a reload or an app restart. |
|
|
46
|
+
| `electron-cast:presentation:send` (send) | page to main | Default mode: one message on an open connection |
|
|
47
|
+
| `electron-cast:presentation:event` | main to page | Default mode: availability, messages, connection state |
|
|
48
|
+
| `electron-cast:call` (invoke) | page to main | `mode: "chromecast"`: `initialize`, `requestSession`, `joinSession`, `sendMessage`, `stopSession`, `leaveSession`, `setReceiverVolume`, `setReceiverMuted` |
|
|
49
|
+
| `electron-cast:event` | main to page | `mode: "chromecast"`: availability, session updates, messages |
|
|
50
|
+
|
|
51
|
+
How the main process validates what arrives:
|
|
52
|
+
|
|
53
|
+
- **Who is asking.** The origin comes from `event.senderFrame` in the main process, never from anything the page
|
|
54
|
+
says. In an iframe it is the iframe's own origin. A call with no sender frame is refused. If the frame's URL cannot be parsed, the origin is `""` and
|
|
55
|
+
`allowOrigin` decides.
|
|
56
|
+
- **Method names.** Only the methods above are accepted. Anything else gets an error reply.
|
|
57
|
+
- **Parameter types.** Every method has a parser that checks types: ids and session ids are strings, `level` is a
|
|
58
|
+
finite number from 0 to 1, `muted` is a boolean, `timeoutMs` is a positive finite number. A call that does not
|
|
59
|
+
match gets `invalid_parameter` (`InvalidAccessError` in default mode). Nothing page-supplied is used as a host,
|
|
60
|
+
port or file path.
|
|
61
|
+
- **Sizes.** Connection, watch and presentation ids are at most 256 characters, a request carries at most 16 URLs,
|
|
62
|
+
a presentation URL is at most 4096 characters, an app id matches `[A-Za-z0-9._-]{1,64}`, and a page-to-receiver
|
|
63
|
+
message over 1,048,576 characters is dropped. The Cast wire limit of 64 KiB still applies below that, and a
|
|
64
|
+
message over it fails with an error instead of being sent. Each page keeps at most 32 availability watches, and at most 100 media
|
|
65
|
+
requests are tracked per connection.
|
|
66
|
+
- **Envelope format.** In default mode, messages on a connection must be one of eight known router message types
|
|
67
|
+
with the expected fields; others are dropped. Only the media requests the Cast SDK sends (`LOAD`, `PLAY`,
|
|
68
|
+
`PAUSE`, `SEEK` and the like) are forwarded on the media namespace.
|
|
69
|
+
- **One request at a time.** A page can have one `requestSession` or `start` pending. A second is refused.
|
|
70
|
+
- **Replies.** Handlers never throw or reject across the boundary; failures come back as `{ ok: false, code }`.
|
|
71
|
+
|
|
72
|
+
What goes back to the page: whether a receiver is available (a boolean), then, for a session the user started, the
|
|
73
|
+
device's friendly name, capabilities and volume, the receiver app's name, namespaces and icon, and the messages that
|
|
74
|
+
app sends. The page never gets a device's IP address or port. In default mode the receiver label is a hash of the
|
|
75
|
+
device id and a per-process random token, and the friendly name is HTML-escaped, because Google's SDK may put it
|
|
76
|
+
into markup. Treat everything a device sends as untrusted data.
|
|
77
|
+
|
|
78
|
+
## User gesture
|
|
79
|
+
|
|
80
|
+
Chrome only lets a page start a cast from a user gesture, and electron-cast follows that in default mode, in two places:
|
|
81
|
+
|
|
82
|
+
- The page-side stand-in rejects `PresentationRequest.start()` with `InvalidAccessError` ("PresentationRequest::start()
|
|
83
|
+
requires user gesture.") when `navigator.userActivation.isActive` is false, as Blink's `PresentationRequest::start()`
|
|
84
|
+
does. This runs in the page's own JavaScript, so it is a compatibility behaviour, not a security boundary.
|
|
85
|
+
- The preload reads `navigator.userActivation.isActive` itself, in its isolated world, when the page calls the bridge's
|
|
86
|
+
`start`, and sends that as `hasGesture`, replacing anything the page passed. The main process refuses a `start`
|
|
87
|
+
whose `hasGesture` is not `true` with `AbortError` and Chrome's message (what `PresentationServiceImpl::StartPresentation`
|
|
88
|
+
reports as `PRESENTATION_REQUEST_CANCELLED`). A page script cannot forge this: it cannot reach the IPC channel, and
|
|
89
|
+
overriding `navigator.userActivation` in the main world does not change the isolated world's view (smoke-tested).
|
|
90
|
+
|
|
91
|
+
Known gap, and the trust boundary: Electron has no main-process API for a frame's transient user activation (`WebFrameMain` and
|
|
92
|
+
`IpcMainInvokeEvent` have none; only `webContents.executeJavaScript(code, userGesture)` and the media-access
|
|
93
|
+
handler's `userGesture` touch the concept), so the check is made in the renderer process, by the preload, instead of
|
|
94
|
+
in the browser process as Chrome does. It holds against a page's scripts. It does not hold against a compromised
|
|
95
|
+
renderer process, which can also forge the IPC itself. An Electron-native handler would get Chromium's browser-side
|
|
96
|
+
check for free.
|
|
97
|
+
|
|
98
|
+
`mode: "chromecast"` has no gesture check at all. A hostile page can call that bridge without a click.
|
|
99
|
+
|
|
100
|
+
The real consent step is `selectDevice`. A session only starts if your callback resolves a device, and the callback
|
|
101
|
+
is your UI in the main process, so the page cannot answer it. Always show the user a prompt, show the requesting
|
|
102
|
+
origin (`request.origin`), and do not auto-pick a device. A page that is allowed to cast can still make the prompt
|
|
103
|
+
appear repeatedly, one at a time, so keep the prompt cancellable and consider rate-limiting it.
|
|
104
|
+
|
|
105
|
+
## allowOrigin
|
|
106
|
+
|
|
107
|
+
`allowOrigin(origin)` is checked on every call from a page, in both modes, using the origin of the frame that made
|
|
108
|
+
the call. When it returns false the call is refused. In `mode: "chromecast"` the page gets `extension_missing`, as if
|
|
109
|
+
electron-cast were not installed. In default mode availability reads as false and `start` fails. If `allowOrigin`
|
|
110
|
+
throws, the call is refused.
|
|
111
|
+
|
|
112
|
+
- **Default: no check.** Without `allowOrigin`, every page in a window that has the preload can cast.
|
|
113
|
+
- **Recommendation: always set it,** and compare against exact origins you control, for example
|
|
114
|
+
`(origin) => origin === "https://music.example.com"`. Do not match with `endsWith`, `includes` or a prefix test.
|
|
115
|
+
- **Install the preload only in windows and views that show pages that should cast.** A window without the preload
|
|
116
|
+
has no way to reach these channels. With `nodeIntegrationInSubFrames`, the preload also runs in iframes. Each frame
|
|
117
|
+
is checked against its own origin.
|
|
118
|
+
|
|
119
|
+
`allowOrigin` is evaluated on each call, so changing what it returns takes effect on the next call. It does not end
|
|
120
|
+
sessions that are already open; to do that, call `dispose()` on the manager.
|
|
121
|
+
|
|
122
|
+
## Scoping of sessions and messages
|
|
123
|
+
|
|
124
|
+
A session records the origin that created it and the set of webContents that are members of it.
|
|
125
|
+
|
|
126
|
+
- **Who can act on a session.** `sendMessage`, `stopSession`, `leaveSession` and the volume calls need the caller's
|
|
127
|
+
webContents to be a member of the session. Other pages, including pages of the same origin in another window,
|
|
128
|
+
cannot message or stop it unless they have joined.
|
|
129
|
+
- **Who can join.** Auto-join needs the caller's origin to equal the session's origin and the same app id.
|
|
130
|
+
`origin_scoped` joins any window of that origin; `tab_and_origin_scoped` (the default policy in Google's SDK) joins
|
|
131
|
+
only the sender that already had the session, including after a reload. Auto-join only finds sessions this run
|
|
132
|
+
started.
|
|
133
|
+
- **Joining by id (default mode).** `reconnect("cast-session_<id>")`, which Google's SDK issues for
|
|
134
|
+
`requestSessionById`, joins by session id and checks no origin, as Chrome does (`AppActivity::CanJoinSession` checks
|
|
135
|
+
only the app id and that the client is not already connected). So the session id acts as the capability: a page
|
|
136
|
+
that knows the id and the session's app id can join it from any origin that `allowOrigin` admits.
|
|
137
|
+
The lookup also finds a session this run did not start, on any known
|
|
138
|
+
device (one still playing from before an app restart, or started from a phone), by asking each device what it runs.
|
|
139
|
+
electron-cast persists no ids; the app decides whether to store one. In `mode: "chromecast"`, `joinSession` still
|
|
140
|
+
needs the caller's origin to equal the session's.
|
|
141
|
+
- **Who receives events.** Events and receiver messages are sent only to the member's own frame (`frame.send`), and
|
|
142
|
+
messages from the device are routed by the receiver app's transport id, so a session sees only its own app's
|
|
143
|
+
traffic.
|
|
144
|
+
- **Lifetime.** A navigation of the page leaves its sessions open on the device, parked, so the next page of the
|
|
145
|
+
same sender can rejoin them (as in Chrome). A destroyed webContents leaves its sessions for good. When a
|
|
146
|
+
session has no members left, electron-cast releases its connection to the app; the app keeps running on the
|
|
147
|
+
device until it is stopped.
|
|
148
|
+
- **Per frame in default mode.** Every frame, iframes included, is its own sender with its own watches, connections
|
|
149
|
+
and sessions, and cannot read, close or message another frame's. Iframes only get a preload with
|
|
150
|
+
`nodeIntegrationInSubFrames: true`, which runs the cast bridge in every iframe of every origin, so keep
|
|
151
|
+
`allowOrigin` strict. A removed iframe or a navigating page ends the iframe's sessions. In `mode: "chromecast"`
|
|
152
|
+
membership is by webContents (main frame only; a call from an iframe is refused), so windows that are all allowed
|
|
153
|
+
by `allowOrigin` share one webContents' sessions.
|
|
154
|
+
|
|
155
|
+
### What a page can do inside its own session
|
|
156
|
+
|
|
157
|
+
A page that holds a session can:
|
|
158
|
+
|
|
159
|
+
- Send messages on the namespaces of the receiver app. This is the point of the Cast protocol: the page and the
|
|
160
|
+
receiver app define their own messages. In default mode the namespace must be one the receiver app lists in its
|
|
161
|
+
status. In `mode: "chromecast"` the page can name any namespace string, including Cast system namespaces, but the
|
|
162
|
+
destination is always the receiver app's own transport. It cannot send to the platform receiver that way.
|
|
163
|
+
- Send media requests (load, play, pause, seek, queue edits), set the device volume and mute, and stop the session.
|
|
164
|
+
- The volume and the stop apply to the device, so they are heard by anyone else using it, and stopping ends the app
|
|
165
|
+
for other senders (phones, for example) that joined the same app.
|
|
166
|
+
|
|
167
|
+
A page cannot launch an app without a session request, cannot choose the device, and cannot reach another page's
|
|
168
|
+
session. It does choose the receiver app id (default mode takes it from the presentation URL, which the SDK builds
|
|
169
|
+
from the app id the page configures), so a page allowed to cast can launch any app on the device the user picked.
|
|
170
|
+
|
|
171
|
+
## TLS and device authentication
|
|
172
|
+
|
|
173
|
+
`CastClient` connects to a device over TLS on port 8009 (or the port advertised in mDNS) with
|
|
174
|
+
`rejectUnauthorized: false`. This is normal for Cast. A Cast device presents a certificate it generated itself, which
|
|
175
|
+
no public certificate authority has signed, so ordinary certificate validation always fails. Chrome also accepts
|
|
176
|
+
that certificate and instead authenticates the device with a separate challenge on the
|
|
177
|
+
`urn:x-cast:com.google.cast.tp.deviceauth` namespace, which checks the device's certificate chain against Google's
|
|
178
|
+
Cast root certificates.
|
|
179
|
+
|
|
180
|
+
From 0.4.0 electron-cast does the same challenge, on by default: after the TLS handshake and before CONNECT,
|
|
181
|
+
`CastClient.connect()` sends a nonce and checks the device's reply (a port of Chromium's
|
|
182
|
+
`cast_auth_util.cc` and certificate code, with Google's Cast root certificates built in). It requires that the TLS
|
|
183
|
+
certificate's validity window is current and short, that the device's certificate chain leads to a Cast root, that
|
|
184
|
+
the chain is not revoked, and that the device's signature over the nonce and this connection's TLS certificate
|
|
185
|
+
verifies, which ties the proof to this connection. A device that fails makes `connect()` reject with `CastAuthError`
|
|
186
|
+
(with a `reason`), the socket is closed, and the device is never listed: as in Chrome, a device is a sink only once its
|
|
187
|
+
channel has passed authentication, so a failing device does not reach the picker. Names still come from mDNS, so show
|
|
188
|
+
them as plain text.
|
|
189
|
+
Details and the differences from Chromium: [docs/DESIGN.md](docs/DESIGN.md).
|
|
190
|
+
|
|
191
|
+
With `verifyDevices: false` (manager) or `verifyDevice: false` (client), none of this runs: the connection is
|
|
192
|
+
encrypted but the device is not authenticated, so anyone on the local network who can answer mDNS queries, or
|
|
193
|
+
intercept traffic between your computer and the device, can pose as a Cast device. If the user picks that device, the
|
|
194
|
+
attacker receives whatever the page sends it, such as media URLs and app-specific messages and tokens (YouTube's lounge
|
|
195
|
+
tokens, for example). It does not get cookies or anything else from the page. Turn it off only for receivers that are
|
|
196
|
+
not Google-certified.
|
|
197
|
+
|
|
198
|
+
`CastClientOptions.tls` is spread after the defaults, so an app that wants to pin a certificate can pass its own
|
|
199
|
+
`tls` options through a custom `createClient`.
|
|
200
|
+
|
|
201
|
+
The `deviceAuth` client option replaces the trust anchors and the clock. It exists for tests and private Cast
|
|
202
|
+
deployments; an app that sets it decides what counts as genuine.
|
|
203
|
+
|
|
204
|
+
**Old releases and devices that send no CRL (the stale fallback CRL).** Revocation uses the CRL the device sends, or else a fallback CRL built
|
|
205
|
+
into the package that counts for 20 weeks from the package's build time. When a release is older than that and the
|
|
206
|
+
device sent no valid CRL, the revocation check is skipped (`CastClient.deviceAuth.revocationChecked` is `false`),
|
|
207
|
+
where Chromium would refuse the device; Chrome updates itself, an Electron app may not, and Chrome likewise stops
|
|
208
|
+
enforcing Certificate Transparency when its built-in log list is over 70 days old
|
|
209
|
+
(`ChromeCTPolicyEnforcer::IsLogDataTimely`). What still holds: the chain to a Cast root, the device certificate
|
|
210
|
+
checks, the signature over this connection's TLS certificate, revocation by a CRL the device sends, and revocation by
|
|
211
|
+
a fallback CRL that has not lapsed. What does not: a device Google has revoked can pass if it sends no CRL. Update
|
|
212
|
+
electron-cast regularly, and treat `revocationChecked: false` as a prompt to do so.
|
|
213
|
+
|
|
214
|
+
## Device addresses
|
|
215
|
+
|
|
216
|
+
Answers to mDNS queries are accepted from any host on the network, so a hostile one can announce a device at an address
|
|
217
|
+
of its choosing, including a public one on the internet or loopback (a local service on this machine). Chrome opens no
|
|
218
|
+
Cast channel to a publicly routable or loopback address unless its `MediaRouterCastAllowAllIPs` policy is set
|
|
219
|
+
(`CastMediaSinkServiceImpl::OpenChannel`), and the manager does the same: no channel is opened to such an address, so
|
|
220
|
+
the device is not listed, offered by `selectDevice` or connected to. Private, link-local, unique-local and
|
|
221
|
+
carrier-grade-NAT (`100.64.0.0/10`) addresses are allowed, as in Chrome. `sinks: { allowAllIps: true }` lifts the rule
|
|
222
|
+
(devices on a routed or VPN network with public addressing). As in Chrome the address checked is the one a channel is
|
|
223
|
+
being opened to, each time one is opened, so a device that later announces a public address gets no channel there; a
|
|
224
|
+
`CastClient` you create yourself connects wherever you point it.
|
|
225
|
+
Chrome's quirks are kept: an IPv4-mapped loopback (`::ffff:127.0.0.1`) is not refused, and an address that cannot be
|
|
226
|
+
parsed is.
|
|
227
|
+
|
|
228
|
+
## mDNS exposure
|
|
229
|
+
|
|
230
|
+
Discovery sends multicast DNS queries for `_googlecast._tcp.local` to `224.0.0.251:5353`:
|
|
231
|
+
|
|
232
|
+
- on every non-internal, non-link-local IPv4 interface the OS reports, including VPN and virtual adapters;
|
|
233
|
+
- over IPv6 as well: queries to `ff02::fb` from one link-local address per adapter. A device found that way is
|
|
234
|
+
connected to over its `fe80::` address with the adapter's zone; IPv4 is preferred when a device has both;
|
|
235
|
+
- right at start, again after 1 s and 3 s, then about every 60 s;
|
|
236
|
+
- with the interface list re-checked every 10 s, so a new network is joined as soon as it appears. A network that goes
|
|
237
|
+
away takes its devices with it at once, and after the machine wakes from sleep the sockets are replaced and queried
|
|
238
|
+
again.
|
|
239
|
+
|
|
240
|
+
It binds UDP port 5353 with address reuse so it can coexist with the system's mDNS responder, and falls back to an
|
|
241
|
+
ephemeral port if that fails. If the IPv6 socket for an adapter cannot be opened, IPv4 carries on. It does not advertise anything and does not answer queries; it only asks. The queries
|
|
242
|
+
reveal to everyone on those networks that this machine looks for Cast devices.
|
|
243
|
+
|
|
244
|
+
Answers are accepted from any host on those networks, parsed with a defensive decoder (malformed packets are dropped),
|
|
245
|
+
and turned into device records. A device record's address comes from the answer, so a hostile host can announce a
|
|
246
|
+
device name and an address of its choosing. As in Chrome, the manager opens a TLS channel to each device found at an
|
|
247
|
+
allowed address (not publicly routable, not loopback) to authenticate it before listing it, so such a host receives a
|
|
248
|
+
TLS connection and an authentication challenge, and nothing more unless it passes. Show the device's name as plain text
|
|
249
|
+
in your picker, since it is attacker-controlled when the network is.
|
|
250
|
+
|
|
251
|
+
Nothing is sent and no socket is opened until you call `manager.start()`. To turn casting off:
|
|
252
|
+
|
|
253
|
+
- never create the manager, or never call `start()`, for users who disable it;
|
|
254
|
+
- call `await manager.dispose()` to stop discovery, close the sockets, close device connections and remove the IPC
|
|
255
|
+
handlers. A disposed manager cannot be restarted; create a new one to turn casting back on.
|
|
256
|
+
|
|
257
|
+
With `presentation: false` only `mode: "chromecast"` pages are served.
|
|
258
|
+
|
|
259
|
+
## SSDP and DIAL HTTP exposure
|
|
260
|
+
|
|
261
|
+
DIAL is on by default, as in Chrome. `dial: false` removes everything in this section.
|
|
262
|
+
|
|
263
|
+
- **SSDP.** `manager.start()` also sends `M-SEARCH` requests to `239.255.255.250:1900`, four times a second apart, on
|
|
264
|
+
every external IPv4 interface (as for mDNS, VPN and virtual adapters included), every 120 s. Each search uses a UDP
|
|
265
|
+
socket on an ephemeral port that is open only while a cycle runs (about 5 s) and takes unicast answers. The search
|
|
266
|
+
tells the networks that this machine looks for DIAL devices, and its `USER-AGENT` carries the Chromium version and the
|
|
267
|
+
OS. Nothing is advertised.
|
|
268
|
+
- **Answers are untrusted.** An answer counts only if its `LOCATION` is an http(s) URL whose host is an IP literal in
|
|
269
|
+
private, loopback or link-local space and equals the address the answer came from, so a host cannot point electron-cast
|
|
270
|
+
at a third party. The `Application-URL` header of the description is held to the same rule, and so is the `Location`
|
|
271
|
+
of a launch (otherwise the stop falls back to `<app url>/run`). Descriptions and app info are read with a reader that
|
|
272
|
+
refuses entity declarations (so no entity expansion), caps nesting at 64 and stops at 256 KiB. At most 256 devices are
|
|
273
|
+
kept. Show a DIAL sink's name as plain text: it is whatever the device's description says.
|
|
274
|
+
- **HTTP to devices.** Without any page involved, each device found is sent one `GET` of its description (again every
|
|
275
|
+
12 hours or when its `CONFIGID` changes). A page that watches the availability of a `cast-dial:` source makes
|
|
276
|
+
electron-cast `GET` that app's info from each device. Launching sends a `POST` and stopping a `DELETE`, after the user
|
|
277
|
+
chose the device in `selectDevice`. These requests are plain HTTP, as the DIAL specification has it; they carry
|
|
278
|
+
`Origin: package:Google-Chrome.<major>.<OS>`, follow no redirect, send no cookies and use no proxy.
|
|
279
|
+
- **What a page can do.** It can ask for the availability of any app name (letters, digits and `-._~`) and so learn
|
|
280
|
+
whether any of the user's DIAL devices has that app (at most 32 apps are asked about at once), unless the app is one Chrome limits to certain origins and the
|
|
281
|
+
page's origin is not one of them. It can launch only on a device the user picked, with any `dialPostData` and launch
|
|
282
|
+
parameter it likes, which the device's app receives. It can send `STOP`, which stops its own route's app. As in Chrome,
|
|
283
|
+
closing a page does not stop a launched app.
|
|
284
|
+
- **DIAL has no authentication.** Unlike Cast it has no device authentication and no TLS: anyone on the network can
|
|
285
|
+
answer a search with a name of their choosing, and the user then sees it in the picker. This matches Chrome.
|
|
286
|
+
|
|
287
|
+
## Mirroring
|
|
288
|
+
|
|
289
|
+
Mirroring is off unless the app passes `mirroring` to `createCastManager`, and only the main process can start it
|
|
290
|
+
(`startCasting`); no page can. What it adds:
|
|
291
|
+
|
|
292
|
+
- **Capture.** The app names the page (`webContentsId`) or screen (`desktopSourceId`) to send. Capture runs in a hidden
|
|
293
|
+
window on a private in-memory session partition. That window is sandboxed, has context isolation, denies navigation
|
|
294
|
+
and new windows, and grants only the media permission. Its page and preload are generated by the library and written
|
|
295
|
+
to a fresh temporary directory (removed when the route ends). Desktop capture uses the one source id the app
|
|
296
|
+
chose, and grants the `display-capture` permission to that window only; loopback audio is only requested when `withAudio` is set. Screen capture can show anything on
|
|
297
|
+
screen, so ask the user before calling it.
|
|
298
|
+
- **Network.** The stream is UDP from an ephemeral port on all interfaces to the device's address (Cast streaming
|
|
299
|
+
has no fixed port). The sender accepts packets only from the endpoint the receiver announced in its ANSWER, and
|
|
300
|
+
ignores others. Frames are AES-128-CTR encrypted with a per-session random key and IV mask, sent in the OFFER over the
|
|
301
|
+
device's TLS channel (the keys are redacted from logs, as Chrome does). The receiver's address comes from the
|
|
302
|
+
authenticated Cast channel, not from the network, and the OFFER goes over the device's one kept-open channel.
|
|
303
|
+
- **Processes.** Encoded frames travel from the hidden window to a utility process over a `MessagePort`, not through
|
|
304
|
+
the main process. A malformed message from the window is ignored; an engine crash ends the route.
|
|
305
|
+
- The device is checked as in every other cast (device authentication), and the receiver app is stopped when the route
|
|
306
|
+
ends.
|
|
307
|
+
|
|
308
|
+
## Dependencies and supply chain
|
|
309
|
+
|
|
310
|
+
electron-cast has no runtime dependencies. It uses Node's `tls`, `dgram` and `crypto`; device authentication,
|
|
311
|
+
including the X.509, CRL and DER parsing, is part of the package rather than a dependency. Electron is an optional
|
|
312
|
+
peer dependency (`electron >=35`) and is never imported: you pass Electron's objects in. The preload entry has no
|
|
313
|
+
imports of its own, so a bundler can inline it. The package ships an ES module build and a CommonJS build.
|
|
314
|
+
|
|
315
|
+
## Reporting a vulnerability
|
|
316
|
+
|
|
317
|
+
Please do not open a public issue for a security problem.
|
|
318
|
+
|
|
319
|
+
Use GitHub's private vulnerability reporting: go to
|
|
320
|
+
[github.com/adammpkins/electron-cast](https://github.com/adammpkins/electron-cast), open the **Security** tab and
|
|
321
|
+
choose **Report a vulnerability**. Include the version, the Electron version, steps to reproduce, and what an attacker
|
|
322
|
+
gains. You will get a reply there, and a fix is released with a credit if you want one.
|
|
323
|
+
|
|
324
|
+
Fixes are made against the latest release.
|
|
@@ -7,5 +7,5 @@ exports.BUILD_TIME = void 0;
|
|
|
7
7
|
* rewrites this one assignment in the emitted dist files, so source checkouts and tests fall back to the date in
|
|
8
8
|
* trust-data.ts and the working tree stays clean.
|
|
9
9
|
*/
|
|
10
|
-
exports.BUILD_TIME =
|
|
10
|
+
exports.BUILD_TIME = 1795607102275;
|
|
11
11
|
//# sourceMappingURL=build-time.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CastDeviceCertPolicy } from "./cast-cert-validator.ts";
|
|
2
|
+
/** Replacements for the trust anchors and the clock in device authentication. For tests and private Cast deployments. */
|
|
2
3
|
export interface DeviceAuthOptions {
|
|
3
4
|
/** Verification time, epoch milliseconds. Defaults to now. */
|
|
4
5
|
now?: number;
|
|
@@ -11,6 +12,7 @@ export interface DeviceAuthOptions {
|
|
|
11
12
|
/** The "build time" the fallback CRL's 20-week window starts at, epoch milliseconds. */
|
|
12
13
|
fallbackCrlBuildTime?: number;
|
|
13
14
|
}
|
|
15
|
+
/** What device authentication established about a device, available as `CastClient.deviceAuth` once connected. */
|
|
14
16
|
export interface DeviceAuthResult {
|
|
15
17
|
policy: CastDeviceCertPolicy;
|
|
16
18
|
hashAlgorithm: "sha1" | "sha256";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cast-auth.js","sourceRoot":"","sources":["../../../../src/client/auth/cast-auth.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"cast-auth.js","sourceRoot":"","sources":["../../../../src/client/auth/cast-auth.ts"],"names":[],"mappings":";;AAyDA,kDAGC;AA8CD,gEA+EC;AAzLD,6CAAkE;AAClE,wDAA6D;AAC7D,oEAA6D;AAC7D,kEAA4G;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GAAG,KAAK,CAAC;IACxB,IAAI,CAAC;QACH,WAAW,GAAG,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,iBAAiB,KAAK,KAAK,IAAI,IAAA,oBAAY,EAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpI,CAAC;IAAC,MAAM,CAAC;QACP,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,yBAAa,CAAC,eAAe,EAAE,yDAAyD,CAAC,CAAC;IAEtH,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,aAAa,EAAE,IAAI;QACnB,WAAW;QACX,eAAe,EAAE,QAAQ,CAAC,KAAK,KAAK,iBAAiB;QACrD,iBAAiB,EAAE,QAAQ,CAAC,KAAK,KAAK,uBAAuB;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { type NetworkInterfaceInfo } from "../discovery/cast-discovery.ts";
|
|
3
|
+
import { type DialDeviceData } from "./parse.ts";
|
|
4
|
+
import { type OpenSsdpSocket } from "./ssdp-socket.ts";
|
|
5
|
+
export interface DialRegistryOptions {
|
|
6
|
+
/** Interfaces to search on; default the external IPv4 addresses (the same set mDNS uses). */
|
|
7
|
+
interfaces?: () => NetworkInterfaceInfo[];
|
|
8
|
+
openSocket?: OpenSsdpSocket;
|
|
9
|
+
/** The `USER-AGENT` of the search: `<product>/<version> <os>` (`BuildRequest`). */
|
|
10
|
+
userAgent?: string;
|
|
11
|
+
/** Epoch milliseconds; default `Date.now`. */
|
|
12
|
+
now?: () => number;
|
|
13
|
+
/** `kDialRefreshIntervalSecs` 120 s. */
|
|
14
|
+
refreshMs?: number;
|
|
15
|
+
/** `kDialExpirationSecs` 240 s. */
|
|
16
|
+
expirationMs?: number;
|
|
17
|
+
/** `kDialMaxDevices` 256. */
|
|
18
|
+
maxDevices?: number;
|
|
19
|
+
/** `kDialRequestIntervalMillis` 1000 ms between the searches of one cycle. */
|
|
20
|
+
requestIntervalMs?: number;
|
|
21
|
+
/** `kDialMaxRequests` 4 searches per cycle. */
|
|
22
|
+
maxRequests?: number;
|
|
23
|
+
/** `kDialResponseTimeoutSecs` 2 s after the last search before the cycle ends. */
|
|
24
|
+
responseTimeoutMs?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface DialRegistryEvents {
|
|
27
|
+
/** The device list changed (or a forced discovery found it unchanged): `DialRegistry::MaybeSendDeviceList`. */
|
|
28
|
+
deviceList: [devices: DialDeviceData[]];
|
|
29
|
+
/** `DialRegistry::DialErrorCode` for what can go wrong here. */
|
|
30
|
+
error: [code: "no_interfaces" | "socket_error" | "network_disconnected", detail?: Error];
|
|
31
|
+
}
|
|
32
|
+
/** Discovers DIAL devices by SSDP on every IPv4 interface and keeps those that keep answering. */
|
|
33
|
+
export declare class DialRegistry extends EventEmitter<DialRegistryEvents> {
|
|
34
|
+
private readonly listIfaces;
|
|
35
|
+
private readonly openSocketFn;
|
|
36
|
+
private readonly request;
|
|
37
|
+
private readonly now;
|
|
38
|
+
private readonly refreshMs;
|
|
39
|
+
private readonly expirationMs;
|
|
40
|
+
private readonly maxDevices;
|
|
41
|
+
private readonly requestIntervalMs;
|
|
42
|
+
private readonly maxRequests;
|
|
43
|
+
private readonly finishDelayMs;
|
|
44
|
+
private readonly byId;
|
|
45
|
+
private sockets;
|
|
46
|
+
private active;
|
|
47
|
+
private sent;
|
|
48
|
+
/** Bumped by every change of the list (and by each discovery that was asked for), like `registry_generation_`. */
|
|
49
|
+
private generation;
|
|
50
|
+
private lastSentGeneration;
|
|
51
|
+
private labelCount;
|
|
52
|
+
private cycle;
|
|
53
|
+
private timers;
|
|
54
|
+
/** Set while periodic discovery runs, as Chromium's `dial_` is. */
|
|
55
|
+
private refreshTimer;
|
|
56
|
+
private started;
|
|
57
|
+
private stopped;
|
|
58
|
+
/** False for `CONNECTION_NONE`: `ReadyToDiscover` then refuses to search. */
|
|
59
|
+
private online;
|
|
60
|
+
constructor(options?: DialRegistryOptions);
|
|
61
|
+
/**
|
|
62
|
+
* `DialRegistry::Start`, then `StartPeriodicDiscovery`: one cycle now, then one every `refreshMs`. With `online: false`
|
|
63
|
+
* (the machine has no network, `CONNECTION_NONE`) nothing is searched until {@link onConnectionChanged} says it has.
|
|
64
|
+
*/
|
|
65
|
+
start(options?: {
|
|
66
|
+
online?: boolean;
|
|
67
|
+
}): void;
|
|
68
|
+
/**
|
|
69
|
+
* `DialRegistry::OnConnectionChanged`. Going offline while discovering reports `network_disconnected`, stops the
|
|
70
|
+
* periodic search, forgets every device and sends the empty list. Coming online when not discovering starts it again,
|
|
71
|
+
* which searches at once and restarts the refresh timer. Coming online while discovering changes nothing.
|
|
72
|
+
*/
|
|
73
|
+
onConnectionChanged(online: boolean): void;
|
|
74
|
+
/** `DialRegistry::DiscoverNow`: starts a cycle unless one is running; the list is then sent even if unchanged. */
|
|
75
|
+
discoverNow(): boolean;
|
|
76
|
+
/** The devices currently registered, with their labels. */
|
|
77
|
+
devices(): DialDeviceData[];
|
|
78
|
+
/** Stops searching and forgets the devices. */
|
|
79
|
+
stop(): void;
|
|
80
|
+
/** `StartPeriodicDiscovery`: nothing when `ReadyToDiscover` says no or discovery already runs. */
|
|
81
|
+
private startPeriodicDiscovery;
|
|
82
|
+
/** `StopPeriodicDiscovery`: the timer stops, and dropping the `DialService` ends a cycle that is running. */
|
|
83
|
+
private stopPeriodicDiscovery;
|
|
84
|
+
/** An EventEmitter throws on "error" without a listener; discovery must never take the process down. */
|
|
85
|
+
private reportError;
|
|
86
|
+
/** `DialServiceImpl::Discover`. Returns false when a cycle is already running. */
|
|
87
|
+
private discover;
|
|
88
|
+
private bind;
|
|
89
|
+
/** `SendOneRequest`: one search on every open socket, then the next after the interval. */
|
|
90
|
+
private sendOne;
|
|
91
|
+
/**
|
|
92
|
+
* DialSocket::CheckResult: a failed socket is closed and NotifyOnError reports it, as a socket error while other
|
|
93
|
+
* sockets are open and as "no interfaces" when none is left. Discovery goes on with what remains.
|
|
94
|
+
*/
|
|
95
|
+
private socketFailed;
|
|
96
|
+
private onPacket;
|
|
97
|
+
private onDeviceDiscovered;
|
|
98
|
+
/** `DialServiceImpl::FinishDiscovery`, then `DialRegistry::OnDiscoveryFinished`. */
|
|
99
|
+
private finish;
|
|
100
|
+
private endCycle;
|
|
101
|
+
/** `PruneExpiredDevices` / `IsDeviceExpired`: the default lifetime, or the answer's own max-age if shorter. */
|
|
102
|
+
private prune;
|
|
103
|
+
private maybeSendList;
|
|
104
|
+
}
|