2022-04-12 13:09:14 +00:00
|
|
|
//
|
|
|
|
// Unlocalized.swift
|
|
|
|
// Passepartout
|
|
|
|
//
|
|
|
|
// Created by Davide De Rosa on 2/26/22.
|
2024-01-14 13:34:21 +00:00
|
|
|
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
|
2022-04-12 13:09:14 +00:00
|
|
|
//
|
|
|
|
// 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
|
2022-06-23 21:31:01 +00:00
|
|
|
import PassepartoutLibrary
|
2022-04-12 13:09:14 +00:00
|
|
|
|
|
|
|
enum Unlocalized {
|
|
|
|
static let appName = Constants.Global.appName
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
enum Placeholders {
|
|
|
|
static let empty = ""
|
|
|
|
|
|
|
|
static let address = "0.0.0.0"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let port = "8080"
|
|
|
|
|
|
|
|
static let hostname = "example.com"
|
|
|
|
|
|
|
|
static let dohURL = "https://example.com/dns-query"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let dotServerName = hostname
|
|
|
|
|
|
|
|
static let dnsAddress = address
|
|
|
|
|
|
|
|
static let dnsDomain = hostname
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let pacURL = "https://proxy/auto-conf"
|
|
|
|
|
|
|
|
static let proxyBypassDomain = hostname
|
|
|
|
}
|
|
|
|
|
|
|
|
enum DNS {
|
|
|
|
static let plain = "Cleartext"
|
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
enum Keychain {
|
2023-05-24 16:19:47 +00:00
|
|
|
static func passwordEntry(_ profile: Profile) -> String {
|
2023-05-28 09:57:35 +00:00
|
|
|
[
|
|
|
|
profile.id.uuidString,
|
|
|
|
profile.currentVPNProtocol.keychainEntry,
|
|
|
|
profile.account.username
|
|
|
|
].joined(separator: ":")
|
2023-05-24 16:19:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static func passwordLabel(_ profile: Profile) -> String {
|
|
|
|
"\(Constants.Global.appName): \(profile.header.name) (\(profile.currentVPNProtocol.keychainEntry))"
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
enum Issues {
|
|
|
|
static let recipient = "issues@\(Constants.Domain.name)"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let subject = "\(appName) - Report issue"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2024-01-07 11:11:16 +00:00
|
|
|
static let bodySentinel = "<replace this with a description of the issue>"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let maxLogBytes = UInt64(20000)
|
|
|
|
|
|
|
|
enum Filenames {
|
2024-01-07 11:11:16 +00:00
|
|
|
static let mime = "text/plain"
|
|
|
|
|
|
|
|
static var appLog: String {
|
2022-04-12 13:09:14 +00:00
|
|
|
let fmt = DateFormatter()
|
|
|
|
fmt.dateFormat = "yyyyMMdd-HHmmss"
|
|
|
|
let iso = fmt.string(from: Date())
|
2024-01-07 11:11:16 +00:00
|
|
|
return "app-\(iso).txt"
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2024-01-07 11:11:16 +00:00
|
|
|
static var tunnelLog: String {
|
|
|
|
let fmt = DateFormatter()
|
|
|
|
fmt.dateFormat = "yyyyMMdd-HHmmss"
|
|
|
|
let iso = fmt.string(from: Date())
|
|
|
|
return "tunnel-\(iso).txt"
|
|
|
|
}
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2024-01-07 11:11:16 +00:00
|
|
|
private static func rawBody(_ description: String, _ metadata: String) -> String {
|
|
|
|
"Hi,\n\n\(description)\n\n\(metadata)\n\nRegards"
|
|
|
|
}
|
2022-04-12 13:09:14 +00:00
|
|
|
|
2024-01-07 11:11:16 +00:00
|
|
|
static func body(
|
|
|
|
providerMetadata: ProviderMetadata?,
|
|
|
|
lastUpdate: Date?,
|
|
|
|
purchasedProductIdentifiers: Set<String>?
|
|
|
|
) -> String {
|
|
|
|
var content: [String] = ["Hi,\n"]
|
|
|
|
content.append(bodySentinel)
|
|
|
|
content.append("\n--\n")
|
|
|
|
content.append(DebugLog.decoratedMetadataString())
|
|
|
|
if let providerMetadata {
|
|
|
|
if let lastUpdate {
|
|
|
|
content.append("Provider: \(providerMetadata.fullName) (last updated: \(lastUpdate))")
|
|
|
|
} else {
|
|
|
|
content.append("Provider: \(providerMetadata.fullName)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if let purchasedProductIdentifiers {
|
|
|
|
content.append("Purchased: \(purchasedProductIdentifiers)")
|
|
|
|
}
|
|
|
|
content.append("\n--\n")
|
|
|
|
content.append("Regards")
|
|
|
|
return content.joined(separator: "\n")
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Social {
|
|
|
|
static let reddit = "Reddit"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 16:51:24 +00:00
|
|
|
private static let twitterHashtags = ["OpenVPN", "WireGuard", "iOS", "macOS"]
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static func twitterIntent(withMessage message: String) -> URL {
|
|
|
|
var text = message
|
|
|
|
for ht in twitterHashtags {
|
|
|
|
text = text.replacingOccurrences(of: ht, with: "#\(ht)")
|
|
|
|
}
|
|
|
|
var comps = URLComponents(string: "https://twitter.com/intent/tweet")!
|
|
|
|
comps.queryItems = [
|
|
|
|
URLQueryItem(name: "url", value: Constants.URLs.website.absoluteString),
|
|
|
|
URLQueryItem(name: "via", value: "keeshux"),
|
|
|
|
URLQueryItem(name: "text", value: text)
|
|
|
|
]
|
|
|
|
return comps.url!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Translations {
|
|
|
|
enum Email {
|
|
|
|
static let recipient = "translate@\(Constants.Domain.name)"
|
|
|
|
|
|
|
|
static let subject = "\(appName) - Translations"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static func body(_ description: String) -> String {
|
2022-09-04 18:09:31 +00:00
|
|
|
"Hi,\n\n\(description)\n\nRegards"
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static let template = "I offer to translate to: "
|
|
|
|
}
|
|
|
|
|
|
|
|
static let translators: [String: String] = [
|
|
|
|
"de": "Christian Lederer, Theodor Tietze",
|
|
|
|
"el": "Konstantinos Koukoulakis",
|
|
|
|
"en-US": "Davide De Rosa",
|
|
|
|
"es": "Davide De Rosa, Elena Vivó",
|
|
|
|
"fr-FR": "Julien Laniel",
|
|
|
|
"it": "Davide De Rosa",
|
|
|
|
"nl": "Norbert de Vreede",
|
|
|
|
"pl": "Piotr Książek",
|
|
|
|
"pt-BR": "Helder Santana",
|
|
|
|
"ru": "Alexander Korobynikov",
|
|
|
|
"sv": "Henry Gross-Hellsen",
|
2022-11-01 13:20:09 +00:00
|
|
|
"ua": "Dmitry Chirkin",
|
2022-04-12 13:09:14 +00:00
|
|
|
"zh-Hans": "OnlyThen"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Credits {
|
|
|
|
static let author = "Davide De Rosa"
|
|
|
|
|
2023-03-19 15:10:40 +00:00
|
|
|
static let licenses: [GenericCreditsView.License] = [.init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"Kvitto",
|
|
|
|
"BSD",
|
|
|
|
URL(string: "https://raw.githubusercontent.com/Cocoanetics/Kvitto/develop/LICENSE")!
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"lzo",
|
|
|
|
"GPLv2",
|
|
|
|
URL(string: "https://www.gnu.org/licenses/gpl-2.0.txt")!
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"OpenSSL",
|
|
|
|
"OpenSSL",
|
|
|
|
URL(string: "https://raw.githubusercontent.com/openssl/openssl/master/LICENSE.txt")!
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"PIATunnel",
|
|
|
|
"MIT",
|
|
|
|
URL(string: "https://raw.githubusercontent.com/pia-foss/tunnel-apple/master/LICENSE")!
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"SwiftGen",
|
|
|
|
"MIT",
|
|
|
|
URL(string: "https://raw.githubusercontent.com/SwiftGen/SwiftGen/master/LICENCE")!
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"SwiftyBeaver",
|
|
|
|
"MIT",
|
|
|
|
URL(string: "https://raw.githubusercontent.com/SwiftyBeaver/SwiftyBeaver/master/LICENSE")!
|
|
|
|
)]
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2023-03-19 15:10:40 +00:00
|
|
|
static let notices: [GenericCreditsView.Notice] = [.init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"Circle Icons",
|
|
|
|
"The logo is taken from the awesome Circle Icons set by Nick Roach."
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"Country flags",
|
|
|
|
"The country flags are taken from: https://github.com/lipis/flag-icon-css/"
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-04-12 13:09:14 +00:00
|
|
|
"OpenVPN",
|
2022-06-16 11:40:48 +00:00
|
|
|
"© Copyright 2022 OpenVPN | OpenVPN is a registered trademark of OpenVPN, Inc."
|
2023-03-19 15:10:40 +00:00
|
|
|
), .init(
|
2022-06-16 11:40:48 +00:00
|
|
|
"WireGuard",
|
|
|
|
"© Copyright 2015-2022 Jason A. Donenfeld. All Rights Reserved. \"WireGuard\" and the \"WireGuard\" logo are registered trademarks of Jason A. Donenfeld."
|
2022-04-12 13:09:14 +00:00
|
|
|
)]
|
|
|
|
}
|
|
|
|
|
|
|
|
enum About {
|
|
|
|
static let github = "GitHub"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let readme = "README"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let changelog = "CHANGELOG"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let faq = "FAQ"
|
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
enum VPN {
|
|
|
|
static let vpn = "VPN"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let certificateAuthority = "CA"
|
|
|
|
|
|
|
|
static let xor = "XOR"
|
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
enum OpenVPN {
|
|
|
|
static let compLZO = "--comp-lzo"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let compress = "--compress"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let lzo = "LZO"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-11-06 17:08:41 +00:00
|
|
|
enum XOR: String {
|
|
|
|
case xormask
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-11-06 17:08:41 +00:00
|
|
|
case xorptrpos
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-11-06 17:08:41 +00:00
|
|
|
case reverse
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-11-06 17:08:41 +00:00
|
|
|
case obfuscate
|
|
|
|
}
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
enum Network {
|
|
|
|
static let dns = "DNS"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let tls = "TLS"
|
|
|
|
|
|
|
|
static let https = "HTTPS"
|
|
|
|
|
|
|
|
static let url = "URL"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let mtu = "MTU"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let ipv4 = "IPv4"
|
|
|
|
|
|
|
|
static let ipv6 = "IPv6"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let ssid = "SSID"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
static let proxyAutoConfiguration = "PAC"
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Other {
|
|
|
|
static let siri = "Siri"
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2023-09-09 19:52:32 +00:00
|
|
|
static let iCloud = "iCloud"
|
|
|
|
|
2023-12-16 19:58:54 +00:00
|
|
|
static let appleTV = "Apple TV"
|
|
|
|
|
2023-03-17 15:49:35 +00:00
|
|
|
static let totp = "TOTP"
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-24 16:19:47 +00:00
|
|
|
|
|
|
|
private extension VPNProtocolType {
|
|
|
|
var keychainEntry: String {
|
|
|
|
switch self {
|
|
|
|
case .openVPN:
|
|
|
|
return "OpenVPN"
|
|
|
|
|
|
|
|
case .wireGuard:
|
|
|
|
return "WireGuard"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|