summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2022-11-03 10:57:01 +0100
committerAndrej Mihajlov <and@mullvad.net>2022-11-07 12:46:51 +0100
commitb1edda468e2e916907eb9aaf4851d1f9aa3f5236 (patch)
treeb8f5fb8e6ddac581080d676833b4230da97a0a54
parent6e1f6034bbe23d9c1b7adb5964a674c883704b3a (diff)
downloadmullvadvpn-b1edda468e2e916907eb9aaf4851d1f9aa3f5236.tar.xz
mullvadvpn-b1edda468e2e916907eb9aaf4851d1f9aa3f5236.zip
Move FixedWidthInteger arithmetics to MullvadTypes
-rw-r--r--ios/MullvadTypes/FixedWidthInteger+Arithmetics.swift (renamed from ios/PacketTunnel/FixedWidthInteger+Arithmetics.swift)8
-rw-r--r--ios/MullvadVPN.xcodeproj/project.pbxproj8
-rw-r--r--ios/PacketTunnel/TunnelMonitor/TunnelMonitor.swift1
3 files changed, 8 insertions, 9 deletions
diff --git a/ios/PacketTunnel/FixedWidthInteger+Arithmetics.swift b/ios/MullvadTypes/FixedWidthInteger+Arithmetics.swift
index 71d1ace4d2..31913775b1 100644
--- a/ios/PacketTunnel/FixedWidthInteger+Arithmetics.swift
+++ b/ios/MullvadTypes/FixedWidthInteger+Arithmetics.swift
@@ -11,7 +11,7 @@ import Foundation
extension FixedWidthInteger {
/// Saturating integer multiplication. Computes `self * rhs`, saturating at the numeric bounds
/// instead of overflowing.
- func saturatingMultiplication(_ rhs: Self) -> Self {
+ public func saturatingMultiplication(_ rhs: Self) -> Self {
let (partialValue, isOverflow) = multipliedReportingOverflow(by: rhs)
if isOverflow {
@@ -23,7 +23,7 @@ extension FixedWidthInteger {
/// Saturating integer addition. Computes `self + rhs`, saturating at the numeric bounds
/// instead of overflowing.
- func saturatingAddition(_ rhs: Self) -> Self {
+ public func saturatingAddition(_ rhs: Self) -> Self {
let (partialValue, isOverflow) = addingReportingOverflow(rhs)
if isOverflow {
@@ -35,7 +35,7 @@ extension FixedWidthInteger {
/// Saturating integer subtraction. Computes `self - rhs`, saturating at the numeric bounds
/// instead of overflowing.
- func saturatingSubtraction(_ rhs: Self) -> Self {
+ public func saturatingSubtraction(_ rhs: Self) -> Self {
let (partialValue, isOverflow) = subtractingReportingOverflow(rhs)
if isOverflow {
@@ -47,7 +47,7 @@ extension FixedWidthInteger {
/// Saturating integer exponentiation. Computes `self ** exp`, saturating at the numeric
/// bounds instead of overflowing.
- func saturatingPow(_ exp: UInt32) -> Self {
+ public func saturatingPow(_ exp: UInt32) -> Self {
let result = pow(Double(self), Double(exp))
if result.isFinite {
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj
index b8d6b404c8..0188108efd 100644
--- a/ios/MullvadVPN.xcodeproj/project.pbxproj
+++ b/ios/MullvadVPN.xcodeproj/project.pbxproj
@@ -101,7 +101,6 @@
58293FB3251241B4005D0BB5 /* CustomTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58293FB2251241B3005D0BB5 /* CustomTextView.swift */; };
58293FB725138B88005D0BB5 /* CustomNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58293FB625138B88005D0BB5 /* CustomNavigationController.swift */; };
582A8A3A28BCE19B00D0F9FB /* FixedWidthIntegerArithmeticsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 582A8A3928BCE19B00D0F9FB /* FixedWidthIntegerArithmeticsTests.swift */; };
- 582A8A3B28BCE1AB00D0F9FB /* FixedWidthInteger+Arithmetics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58900D0228BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift */; };
582AE3102440A6CA00E6733A /* AccountTokenInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 582AE30F2440A6CA00E6733A /* AccountTokenInput.swift */; };
582AE3122440CA0D00E6733A /* AccountTokenInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 582AE3112440CA0D00E6733A /* AccountTokenInputTests.swift */; };
582AE3132440CA2700E6733A /* AccountTokenInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 582AE30F2440A6CA00E6733A /* AccountTokenInput.swift */; };
@@ -193,7 +192,6 @@
5888AD83227B11080051EB06 /* SelectLocationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5888AD82227B11080051EB06 /* SelectLocationCell.swift */; };
5888AD87227B17950051EB06 /* SelectLocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5888AD86227B17950051EB06 /* SelectLocationViewController.swift */; };
588E4EAE28FEEDD8008046E3 /* MullvadREST.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06799ABC28F98E1D00ACD94E /* MullvadREST.framework */; };
- 58900D0328BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58900D0228BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift */; };
58906DE02445C7A5002F0673 /* NEProviderStopReason+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58906DDF2445C7A5002F0673 /* NEProviderStopReason+Debug.swift */; };
58907D9524D17B4E00CFC3F5 /* DisconnectSplitButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58907D9424D17B4E00CFC3F5 /* DisconnectSplitButton.swift */; };
5891BF1C25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5891BF1B25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift */; };
@@ -231,6 +229,7 @@
589A455F28E094BF00565204 /* OperationConditionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 580CBFB72848D503007878F0 /* OperationConditionTests.swift */; };
58A1AA8C23F5584C009F7EA6 /* ConnectionPanelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58A1AA8B23F5584B009F7EA6 /* ConnectionPanelView.swift */; };
58A3BDB028A1821A00C8C2C6 /* WgStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58A3BDAF28A1821A00C8C2C6 /* WgStats.swift */; };
+ 58A8B0842913C6F7004B59B1 /* FixedWidthInteger+Arithmetics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58900D0228BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift */; };
58A99ED3240014A0006599E9 /* TermsOfServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58A99ED2240014A0006599E9 /* TermsOfServiceViewController.swift */; };
58AC829428F803A200181C40 /* libMullvadLogging.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 581943D628F800C900B0CB5E /* libMullvadLogging.a */; };
58AC829528F803A200181C40 /* libMullvadTypes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 581943F128F8014500B0CB5E /* libMullvadTypes.a */; };
@@ -1029,6 +1028,7 @@
5898D2AF2902A67C00EB5EBA /* RelayLocation.swift */,
585DA89826B0329200B8C587 /* PacketTunnelStatus.swift */,
5898D2B62902A9EA00EB5EBA /* PacketTunnelRelay.swift */,
+ 58900D0228BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift */,
);
path = MullvadTypes;
sourceTree = "<group>";
@@ -1366,7 +1366,6 @@
58E0729C28814AAE008902F8 /* PacketTunnelConfiguration.swift */,
58CE5E7B224146470008646E /* PacketTunnelProvider.swift */,
58E072A028814B0E008902F8 /* MullvadEndpoint+WgEndpoint.swift */,
- 58900D0228BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift */,
58E072A228814B96008902F8 /* TunnelMonitor */,
58E07298288031D5008902F8 /* WireGuardAdapterError+Localization.swift */,
58E0729E28814ACC008902F8 /* WireGuardLogLevel+Logging.swift */,
@@ -1997,6 +1996,7 @@
5898D2B82902ABC400EB5EBA /* KeychainError.swift in Sources */,
581943FC28F8020500B0CB5E /* Error+Chain.swift in Sources */,
5898D29329017CFD00EB5EBA /* Location.swift in Sources */,
+ 58A8B0842913C6F7004B59B1 /* FixedWidthInteger+Arithmetics.swift in Sources */,
581943FB28F801D500B0CB5E /* CustomErrorDescriptionProtocol.swift in Sources */,
5898D2B52902A8F000EB5EBA /* RelayConstraint.swift in Sources */,
5898D2B42902A8F000EB5EBA /* RelayConstraints.swift in Sources */,
@@ -2057,7 +2057,6 @@
5807E2C3243203E700F5FF30 /* String+Split.swift in Sources */,
58B0A2A8238EE68200BC001D /* RelaySelectorTests.swift in Sources */,
5819C2152726CC9400D6EC38 /* DataSourceSnapshot.swift in Sources */,
- 582A8A3B28BCE1AB00D0F9FB /* FixedWidthInteger+Arithmetics.swift in Sources */,
5896AE88246D7FAF005B36CB /* CustomDateComponentsFormatting.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -2241,7 +2240,6 @@
580F8B872819795C002E0998 /* DNSSettings.swift in Sources */,
58E072A128814B0E008902F8 /* MullvadEndpoint+WgEndpoint.swift in Sources */,
06AC116228F94C450037AF9A /* ApplicationConfiguration.swift in Sources */,
- 58900D0328BBDCC70094E4F0 /* FixedWidthInteger+Arithmetics.swift in Sources */,
58A3BDB028A1821A00C8C2C6 /* WgStats.swift in Sources */,
5877D70F282137E8002FCFC7 /* SettingsManager.swift in Sources */,
58CE38C728992C8700A6D6E5 /* WireGuardAdapterError+Localization.swift in Sources */,
diff --git a/ios/PacketTunnel/TunnelMonitor/TunnelMonitor.swift b/ios/PacketTunnel/TunnelMonitor/TunnelMonitor.swift
index 00a43108d9..e2ae625886 100644
--- a/ios/PacketTunnel/TunnelMonitor/TunnelMonitor.swift
+++ b/ios/PacketTunnel/TunnelMonitor/TunnelMonitor.swift
@@ -10,6 +10,7 @@ import Foundation
import MullvadLogging
import NetworkExtension
import WireGuardKit
+import MullvadTypes
/// Interval for periodic heartbeat ping issued when traffic is flowing.
/// Should help to detect connectivity issues on networks that drop traffic in one of directions,