mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Rename OpenVPN profile file and add profile loader
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// ProfileLoader.swift
|
||||||
|
// OpenVPN Adapter
|
||||||
|
//
|
||||||
|
// Created by Sergey Abramchuk on 22.04.17.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
enum ProfileType: String {
|
||||||
|
case localKeyAuthentication = "local_key_auth"
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProfileLoader {
|
||||||
|
|
||||||
|
static func getVPNProfile(type: ProfileType) -> Data {
|
||||||
|
let fileName = type.rawValue
|
||||||
|
|
||||||
|
guard
|
||||||
|
let path = Bundle.current.url(forResource: fileName, withExtension: "ovpn"),
|
||||||
|
let profile = try? Data(contentsOf: path)
|
||||||
|
else {
|
||||||
|
fatalError("Failed to retrieve OpenVPN profile")
|
||||||
|
}
|
||||||
|
|
||||||
|
return profile
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user