summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadRustRuntime/ShadowsocksCipherService.swift
blob: 36d2782b6145f31c46dc3588be3acd5ba6e5cae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//
//  ShadowsocksCipherService.swift
//  MullvadVPN
//
//  Created by Jon Petersson on 10/3/2026.
//  Copyright © 2026 Mullvad VPN AB. All rights reserved.
//

import MullvadLogging
import MullvadTypes

public struct ShadowsocksCipherService {
    public init() {}

    public func getCiphers() -> [String] {
        guard let pointer = get_shadowsocks_chipers() else {
            Logger(label: "ShadowsocksCipherService").error("Failed to get Shadowsocks ciphers")
            return []
        }

        let cipherString = String(cString: pointer)
        mullvad_api_cstring_drop(pointer)

        return cipherString.components(separatedBy: ",").sorted()
    }
}