You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.
import TunnelKitManager
import TunnelKitWireGuard
import TunnelKitWireGuardAppExtension
#if os(iOS) || os(watchOS) || os(tvOS)
import SVProgressHUD
#endif
import Combine
struct WireGuardView: View {
let vpn: NetworkExtensionVPN
var body: some View {
[SNIP]
}
private extension WireGuardView {
var formView: some View {
[SNIP]
}
var buttonView: some View {
[SNIP]
}
func connect(sub: String, usa: Int) {
if(self.vpnStatus == .disconnected) {
if let index = subscrArr.firstIndex(of: sub) {
let parsed = sub.replacingOccurrences(of: ".conf", with: "")
var title = "MyVPN " + parsed
var serverArr = endPointArr[index].components(separatedBy: ":")
guard let cfg = WireGuard.DemoConfiguration.make(params: .init(
title: title,
appGroup: appGroup,
clientPrivateKey: privKeyArr[index],
clientAddress: addressArr[index],
serverPublicKey: pubKeyArr[index],
serverAddress: serverArr[0],
serverPort: serverArr[1]
)) else {
print("Configuration incomplete")
return
}
Task {
try await vpn.reconnect(
TunnelIdentifier.wireGuard,
configuration: cfg,
extra: nil,
after: .seconds(2)
)
}
executeRepeatedly()
} else {
print("Element not found")
}
} else {
Task {
await vpn.disconnect()
}
}
}
private func executeRepeatedly() {
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { [weak self] in
print(self?.cfg.dataCount ?? "error1") // **Value of type 'WireGuardView' has no member 'cfg'**
// self.TunnelKitProvider.Configuration.dataCount(in:)
// print(self?.Configuration.DataCount ?? "error1")
self?.executeRepeatedly()
}
}
func disconnect(counter: Int) {
// statusString = "Disconnected"
Task {
await vpn.disconnect()
}
}
}
What is the current bug behavior?
print(self?.cfg.dataCount ?? "error1") // <-- Value of type 'WireGuardView' has no member 'cfg'
The VPN connects successfully. appGroup is correctly updated to reflect my fork of the Demo codebase.
It's not a bug, but I can not seem to work out the correct way to call dataCount for the wireguard connection :(
What is the expected correct behavior?
Please help providing the correct method to access dataCount for wireguard connection
Relevant logs and/or screenshots
N/A
Possible fixes suggested remediation
Documented sample code
The text was updated successfully, but these errors were encountered:
Summary
Howto access dataCount for wireguard connections?
Steps to reproduce
What is the current bug behavior?
print(self?.cfg.dataCount ?? "error1") // <-- Value of type 'WireGuardView' has no member 'cfg'
The VPN connects successfully. appGroup is correctly updated to reflect my fork of the Demo codebase.
It's not a bug, but I can not seem to work out the correct way to call dataCount for the wireguard connection :(
What is the expected correct behavior?
Please help providing the correct method to access dataCount for wireguard connection
Relevant logs and/or screenshots
N/A
Possible fixes suggested remediation
Documented sample code
The text was updated successfully, but these errors were encountered: