Skip to content

Commit

Permalink
feat: update supportedProtocols method in ConnectionSettings.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajhilje committed Nov 2, 2023
1 parent 76136c9 commit fe1aaad
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion IVPNClient/Enums/ConnectionSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ enum ConnectionSettings {
var filteredProtocols = [ConnectionSettings]()

for protocolObj in protocols where protocolObj.tunnelType() == self.tunnelType() {
filteredProtocols.append(protocolObj)
if UserDefaults.shared.isV2ray && tunnelType() == .wireguard && UserDefaults.shared.v2rayProtocol == protocolObj.storedProtocolType().lowercased() {
if UserDefaults.shared.v2rayProtocol == protocolObj.storedProtocolType().lowercased() {
filteredProtocols.append(protocolObj)
}
} else {
filteredProtocols.append(protocolObj)
}
}

return filteredProtocols
Expand Down Expand Up @@ -255,6 +261,22 @@ enum ConnectionSettings {
}
}

func storedProtocolType() -> String {
switch self {
case .ipsec:
return "IKEv2"
case .openvpn(let proto, _):
switch proto {
case .tcp:
return "TCP"
case .udp:
return "UDP"
}
case .wireguard:
return "UDP"
}
}

func wireguardProtocol() -> String {
if UserDefaults.shared.isV2ray && UserDefaults.shared.v2rayProtocol == "tcp" {
return "TCP"
Expand Down

0 comments on commit fe1aaad

Please sign in to comment.