-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a local network probe to trigger local network privacy dialog
- Loading branch information
1 parent
3ad7afe
commit 510c155
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
ios/MullvadVPN/AccessMethodRepository/LocalNetworkProbe.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// LocalNetworkProbe.swift | ||
// MullvadVPN | ||
// | ||
// Created by Marco Nikic on 2024-01-25. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Network | ||
|
||
struct LocalNetworkProbe { | ||
/// Does a best effort attempt to trigger the local network privacy alert. | ||
func triggerLocalNetworkPrivacyAlert() { | ||
let dispatchQueue = DispatchQueue(label: "com.mullvad.localNetworkAlert") | ||
let localIpv4Connection = NWConnection( | ||
to: NWEndpoint.hostPort(host: .ipv4(.broadcast), port: .any), | ||
using: .udp | ||
) | ||
localIpv4Connection.start(queue: dispatchQueue) | ||
|
||
let localIpv6Connection = NWConnection( | ||
to: NWEndpoint.hostPort(host: .ipv6(.broadcast), port: .any), | ||
using: .udp | ||
) | ||
localIpv6Connection.start(queue: dispatchQueue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters