Add data count to WireGuard connections (#430)

Closes #312
This commit is contained in:
Davide De Rosa 2023-12-14 22:18:20 +01:00 committed by GitHub
parent 4a92acbeb9
commit 5cfa32dbb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 6 deletions

View File

@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
- Upgrade OpenSSL to 3.2.0. [tunnelkit#336](https://github.com/passepartoutvpn/tunnelkit/issues/336)
- WireGuard: Show data count. [#312](https://github.com/passepartoutvpn/passepartout-apple/issues/312)
## 2.2.1 (2023-10-14)
### Fixed

View File

@ -167,6 +167,7 @@
0EBE880F281B18DE0090D9E6 /* OrganizerView+ProfileRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EBE880E281B18DE0090D9E6 /* OrganizerView+ProfileRow.swift */; };
0ECB78E9285F5DE300B0E460 /* PassepartoutMac.bundle in Embed Plugins */ = {isa = PBXBuildFile; fileRef = 0ECB78DA285F52F700B0E460 /* PassepartoutMac.bundle */; platformFilter = maccatalyst; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0ECF71EE27B6A99300CDB528 /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ECF71ED27B6A99300CDB528 /* AccountView.swift */; };
0ED1A5FD2B2B98CC00A0EA90 /* Constants+Tunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1A5FC2B2B98CC00A0EA90 /* Constants+Tunnel.swift */; };
0ED1D6DC27DBA41700983466 /* DiagnosticsView+OpenVPN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1D6DB27DBA41700983466 /* DiagnosticsView+OpenVPN.swift */; };
0ED1D6DE27DBA42100983466 /* DiagnosticsView+WireGuard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1D6DD27DBA42100983466 /* DiagnosticsView+WireGuard.swift */; };
0ED2B33927D3C49800FD8EA9 /* OpenVPNAppExtension in Frameworks */ = {isa = PBXBuildFile; productRef = 0ED2B33827D3C49800FD8EA9 /* OpenVPNAppExtension */; };
@ -490,6 +491,7 @@
0ECB78E1285F53ED00B0E460 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
0ECB78EA2861D1F300B0E460 /* PassepartoutLibrary */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = PassepartoutLibrary; sourceTree = "<group>"; };
0ECF71ED27B6A99300CDB528 /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = "<group>"; };
0ED1A5FC2B2B98CC00A0EA90 /* Constants+Tunnel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Constants+Tunnel.swift"; sourceTree = "<group>"; };
0ED1D6DB27DBA41700983466 /* DiagnosticsView+OpenVPN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DiagnosticsView+OpenVPN.swift"; sourceTree = "<group>"; };
0ED1D6DD27DBA42100983466 /* DiagnosticsView+WireGuard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DiagnosticsView+WireGuard.swift"; sourceTree = "<group>"; };
0ED2B34A27D3C77800FD8EA9 /* PassepartoutWireGuardTunnel.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = PassepartoutWireGuardTunnel.appex; sourceTree = BUILT_PRODUCTS_DIR; };
@ -987,6 +989,7 @@
0ED2B33D27D3C53400FD8EA9 /* WireGuard */ = {
isa = PBXGroup;
children = (
0ED1A5FC2B2B98CC00A0EA90 /* Constants+Tunnel.swift */,
0ED2B35A27D3C94F00FD8EA9 /* PacketTunnelProvider.swift */,
);
path = WireGuard;
@ -1577,6 +1580,7 @@
files = (
0ED2B35B27D3C94F00FD8EA9 /* PacketTunnelProvider.swift in Sources */,
0ED30DDD27EA35230057D8A3 /* Constants.swift in Sources */,
0ED1A5FD2B2B98CC00A0EA90 /* Constants+Tunnel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -33,8 +33,8 @@
"repositoryURL": "https://github.com/passepartoutvpn/openssl-apple",
"state": {
"branch": null,
"revision": "757c074af45e4f2514fe63f649ccdde966183e90",
"version": "1.1.11700"
"revision": "c15562540646602300df94540765fbe27b6d5474",
"version": "3.2.0"
}
},
{
@ -51,8 +51,8 @@
"repositoryURL": "https://github.com/passepartoutvpn/tunnelkit",
"state": {
"branch": null,
"revision": "9525f49a9799377d89db6dc2446d08b6e05304c3",
"version": "6.1.1"
"revision": "bda84bf569792fbb702d0173de3c9c58768f9153",
"version": null
}
},
{

View File

@ -0,0 +1,32 @@
//
// Constants+Tunnel.swift
// Passepartout
//
// Created by Davide De Rosa on 12/14/23.
// Copyright (c) 2023 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of Passepartout.
//
// Passepartout is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Passepartout is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
extension Constants {
enum WireGuardTunnel {
static let dataCountInterval = 5000
}
}

View File

@ -27,4 +27,8 @@ import Foundation
import WireGuardAppExtension
final class PacketTunnelProvider: WireGuardTunnelProvider {
override func startTunnel(options: [String: NSObject]?, completionHandler: @escaping (Error?) -> Void) {
dataCountInterval = Constants.WireGuardTunnel.dataCountInterval
super.startTunnel(options: options, completionHandler: completionHandler)
}
}

View File

@ -23,8 +23,8 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", from: "6.1.1"),
// .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("d69899bbc032dac0a7218ba160d3a85c16cd8506")),
// .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", from: "6.1.1"),
.package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("bda84bf569792fbb702d0173de3c9c58768f9153")),
// .package(name: "TunnelKit", path: "../../tunnelkit"),
.package(url: "https://github.com/zoul/generic-json-swift", from: "2.0.0"),
.package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0")

View File

@ -383,6 +383,9 @@ private extension TunnelKitVPNManagerStrategy {
case tunnelBundleIdentifier(.openVPN):
return defaults.openVPNDataCount
case tunnelBundleIdentifier(.wireGuard):
return defaults.wireGuardDataCount
default:
return nil
}