tunnelkit/Sources/TunnelKitOpenVPNCore/CompressionAlgorithm.swift

66 lines
1.8 KiB
Swift
Raw Permalink Normal View History

//
// CompressionAlgorithm.swift
// TunnelKit
//
// Created by Davide De Rosa on 3/19/19.
2024-01-14 13:33:14 +00:00
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of TunnelKit.
//
// TunnelKit 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.
//
// TunnelKit 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 TunnelKit. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import CTunnelKitOpenVPNCore
extension OpenVPN {
2023-04-20 19:52:45 +00:00
/// Defines the type of compression algorithm.
public enum CompressionAlgorithm: Int, Codable, CustomStringConvertible {
2023-04-20 19:52:45 +00:00
/// No compression.
case disabled
2023-04-20 19:52:45 +00:00
/// LZO compression.
case LZO
2023-04-20 19:52:45 +00:00
/// Any other compression algorithm (unsupported).
case other
2023-04-20 19:52:45 +00:00
public var native: CompressionAlgorithmNative {
guard let val = CompressionAlgorithmNative(rawValue: rawValue) else {
fatalError("Unhandled CompressionAlgorithm bridging")
}
return val
}
2023-04-20 19:52:45 +00:00
// MARK: CustomStringConvertible
2023-04-20 19:52:45 +00:00
public var description: String {
switch self {
case .disabled:
return "disabled"
2023-04-20 19:52:45 +00:00
case .LZO:
return "lzo"
2023-04-20 19:52:45 +00:00
case .other:
return "other"
}
}
}
}