diff --git a/IVPNClient/Enums/ConnectionSettings.swift b/IVPNClient/Enums/ConnectionSettings.swift index 848b4c066..9779a45bc 100644 --- a/IVPNClient/Enums/ConnectionSettings.swift +++ b/IVPNClient/Enums/ConnectionSettings.swift @@ -45,7 +45,7 @@ enum ConnectionSettings { return "OpenVPN, UDP \(port)" } case .wireguard(_, let port): - return "WireGuard, UDP \(port)" + return "WireGuard, \(wireguardProtocol()) \(port)" } } @@ -60,8 +60,12 @@ enum ConnectionSettings { case .udp: return "OpenVPN, UDP" } - case .wireguard: - return "WireGuard, UDP" + case .wireguard(_, let port): + if UserDefaults.shared.isV2ray { + return "WireGuard, \(wireguardProtocol()) \(port)" + } + + return "WireGuard, \(wireguardProtocol())" } } @@ -104,7 +108,27 @@ enum ConnectionSettings { return "UDP \(port)" } case .wireguard(_, let port): - return "UDP \(port)" + return "\(wireguardProtocol()) \(port)" + } + } + + func formatProtocolMultiHop() -> String { + switch self { + case .ipsec: + return "IKEv2" + case .openvpn(let proto, _): + switch proto { + case .tcp: + return "TCP" + case .udp: + return "UDP" + } + case .wireguard(_, let port): + if UserDefaults.shared.isV2ray { + return "\(wireguardProtocol()) \(port)" + } + + return "\(wireguardProtocol())" } } @@ -227,8 +251,16 @@ enum ConnectionSettings { return "UDP" } case .wireguard: - return "UDP" + return wireguardProtocol() + } + } + + func wireguardProtocol() -> String { + if UserDefaults.shared.isV2ray && UserDefaults.shared.v2rayProtocol == "tcp" { + return "TCP" } + + return "UDP" } static func == (lhs: ConnectionSettings, rhs: ConnectionSettings) -> Bool { diff --git a/IVPNClient/Scenes/TableCells/ProtocolTableViewCell.swift b/IVPNClient/Scenes/TableCells/ProtocolTableViewCell.swift index 39b9e1684..9d09a37c0 100644 --- a/IVPNClient/Scenes/TableCells/ProtocolTableViewCell.swift +++ b/IVPNClient/Scenes/TableCells/ProtocolTableViewCell.swift @@ -94,7 +94,7 @@ class ProtocolTableViewCell: UITableViewCell { private func setupSelectAction(title: String) { protocolLabel.text = title - protocolSettingsLabel.text = UserDefaults.shared.isMultiHop ? Application.shared.settings.connectionProtocol.protocolType() : Application.shared.settings.connectionProtocol.formatProtocol() + protocolSettingsLabel.text = UserDefaults.shared.isMultiHop ? Application.shared.settings.connectionProtocol.formatProtocolMultiHop() : Application.shared.settings.connectionProtocol.formatProtocol() accessoryType = .disclosureIndicator isUserInteractionEnabled = true selectionStyle = .default diff --git a/IVPNClient/Scenes/ViewControllers/ProtocolViewController.swift b/IVPNClient/Scenes/ViewControllers/ProtocolViewController.swift index 57349e3c8..a3fa3166a 100644 --- a/IVPNClient/Scenes/ViewControllers/ProtocolViewController.swift +++ b/IVPNClient/Scenes/ViewControllers/ProtocolViewController.swift @@ -69,7 +69,7 @@ class ProtocolViewController: UITableViewController { collection.append(ConnectionSettings.tunnelTypes(protocols: Config.supportedProtocolTypes)) if connectionProtocol.tunnelType() == .wireguard { - if UserDefaults.shared.isMultiHop { + if UserDefaults.shared.isMultiHop && !UserDefaults.shared.isV2ray { collection.append([.wireguard(.udp, 1), .wireguard(.udp, 2)]) } else { collection.append([.wireguard(.udp, 0), .wireguard(.udp, 1), .wireguard(.udp, 2)])