<!DOCTYPE html>
<html>
<body>
<script>
function gatherCandidates()
{
    var pc = new RTCPeerConnection();
    pc.createDataChannel("");

    var candidates = [];
    return new Promise((resolve, reject) => {
        pc.onicecandidate = (event) => {
            if (event.candidate === null) {
                resolve(candidates);
                return;
            }
            if (event.candidate.candidate.indexOf('.local') === -1)
                candidates.push(event.candidate.candidate);
        };
        pc.createOffer().then((offer) => {
            pc.setLocalDescription(offer);
        });
    });
}

function checkFiltering()
{
    gatherCandidates().then((candidates) => {
        parent.postMessage(candidates.length ? "filtering disabled" : "filtering enabled", "*");
    });
}

window.addEventListener("message", (event) => {
    checkFiltering();
});

checkFiltering();

</script>
<div>Checking ICE candidate filtering</div>
</body>
</html>


