mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
webrtc: improve private address range check
This commit is contained in:
4
plugins/webrtc/package-lock.json
generated
4
plugins/webrtc/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.74",
|
||||
"version": "0.1.75",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.74",
|
||||
"version": "0.1.75",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
"@scrypted/sdk": "file:../../sdk",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.74",
|
||||
"version": "0.1.75",
|
||||
"scripts": {
|
||||
"scrypted-setup-project": "scrypted-setup-project",
|
||||
"prescrypted-setup-project": "scrypted-package-json",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Deferred } from "@scrypted/common/src/deferred";
|
||||
import sdk, { FFmpegInput, FFmpegTranscodeStream, Intercom, MediaObject, MediaStreamDestination, MediaStreamFeedback, RequestMediaStream, RTCAVSignalingSetup, RTCConnectionManagement, RTCMediaObjectTrack, RTCSignalingOptions, RTCSignalingSession, ScryptedDevice, ScryptedMimeTypes } from "@scrypted/sdk";
|
||||
import { ScryptedSessionControl } from "./session-control";
|
||||
import { requiredAudioCodecs, requiredVideoCodec } from "./webrtc-required-codecs";
|
||||
import { isLocalIceTransport, logIsLocalIceTransport } from "./werift-util";
|
||||
import { logIsLocalIceTransport } from "./werift-util";
|
||||
|
||||
import { addVideoFilterArguments } from "@scrypted/common/src/ffmpeg-helpers";
|
||||
import { connectRTCSignalingClients, legacyGetSignalingSessionOptions } from "@scrypted/common/src/rtc-signaling";
|
||||
|
||||
@@ -43,6 +43,13 @@ export function getWeriftIceServers(configuration: RTCConfiguration): RTCIceServ
|
||||
return ret;
|
||||
}
|
||||
|
||||
// node-ip is missing this range.
|
||||
// https://en.wikipedia.org/wiki/Reserved_IP_addresses
|
||||
const additionalPrivate = ip.cidrSubnet('198.18.0.0/15');
|
||||
function isPrivate(address: string) {
|
||||
return ip.isPrivate(address) || additionalPrivate.contains(address);
|
||||
}
|
||||
|
||||
export function isLocalIceTransport(pc: RTCPeerConnection) {
|
||||
let isLocalNetwork = true;
|
||||
let destinationId: string;
|
||||
@@ -60,7 +67,7 @@ export function isLocalIceTransport(pc: RTCPeerConnection) {
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
isLocalNetwork = isLocalNetwork && (ip.isPrivate(address) || sameNetwork);
|
||||
isLocalNetwork = isLocalNetwork && (isPrivate(address) || sameNetwork);
|
||||
}
|
||||
const ipv4 = ip.isV4Format(destinationId);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user