Skip to content

Commit

Permalink
PIA-1940: Add dnsFollowAppRules to VpnState object
Browse files Browse the repository at this point in the history
  • Loading branch information
kp-michele-emiliani committed Jun 18, 2024
1 parent 1c4ad05 commit 3f41c30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ProxyExtension/SplitTunnelProxyProvider/VpnState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ struct VpnStateFactory {
}
vpnState.isConnected = isConnected
log(.info, "isConnected: \(isConnected)")

guard let dnsFollowAppRules = options!["dnsFollowAppRules"] as? Bool else {
log(.error, "Error: Cannot find dnsFollowAppRules in options")
return nil
}
vpnState.dnsFollowAppRules = dnsFollowAppRules
log(.info, "dnsFollowAppRules: \(dnsFollowAppRules)")

guard let whitelistGroupName = options!["whitelistGroupName"] as? String else {
log(.error, "Error: Cannot find whitelistGroupName in options")
Expand All @@ -78,5 +85,6 @@ struct VpnState: Equatable {
var serverAddress: String = ""
var routeVpn: Bool = false
var isConnected: Bool = false
var dnsFollowAppRules: Bool = false
var whitelistGroupName: String = ""
}
2 changes: 2 additions & 0 deletions ProxyTests/MessageHandlerTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class MessageHandlerTest: QuickSpec {
"serverAddress": "1.1.1.1",
"routeVpn": true,
"isConnected": true,
"dnsFollowAppRules": true,
"whitelistGroupName": "acmevpn"
]

Expand All @@ -54,6 +55,7 @@ final class MessageHandlerTest: QuickSpec {
expect(vpnState.serverAddress).to(equal("1.1.1.1"))
expect(vpnState.routeVpn).to(equal(true))
expect(vpnState.isConnected).to(equal(true))
expect(vpnState.dnsFollowAppRules).to(equal(true))
expect(vpnState.whitelistGroupName).to(equal("acmevpn"))
}

Expand Down
2 changes: 2 additions & 0 deletions ProxyTests/VpnStateTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class VpnStateSpec: QuickSpec {
"logLevel" : "debug",
"routeVpn" : true,
"isConnected" : true,
"dnsFollowAppRules": true,
"whitelistGroupName" : "group1"]
expect(VpnStateFactory.create(options: correctOptions)).toNot(beNil())
}
Expand All @@ -38,6 +39,7 @@ class VpnStateSpec: QuickSpec {
"logLevel" : "debug",
"routeVpn" : true,
"isConnected" : true,
"dnsFollowAppRules": true,
"whitelistGroupName" : "group1"]
expect(VpnStateFactory.create(options: wrongTypeOptions)).to(beNil())
}
Expand Down

0 comments on commit 3f41c30

Please sign in to comment.