31 lines
1.2 KiB
Swift
31 lines
1.2 KiB
Swift
|
|
// VoiceCatConfig — Swift-idiomatic mirror of `vc_config` (voicecat.h). Passed to
|
||
|
|
// VoiceCatClient.init. The native CString storage for the string fields is held for the
|
||
|
|
// client's entire lifetime inside VoiceCatClient — see VoiceCatClient.swift's doc comment
|
||
|
|
// on why (the core stores raw pointers from vc_config by value, it does not copy the data).
|
||
|
|
|
||
|
|
import VoiceCatC
|
||
|
|
|
||
|
|
/// Configuration for a `VoiceCatClient`. Mirrors `vc_config`.
|
||
|
|
public struct VoiceCatConfig: Sendable {
|
||
|
|
/// E.g. "VoiceCat-macOS". Forwarded in `ClientHello.client_name`.
|
||
|
|
public let clientName: String
|
||
|
|
/// E.g. "0.0.1". Forwarded in `ClientHello.client_version`.
|
||
|
|
public let clientVersion: String
|
||
|
|
public let logLevel: VoiceCatLogLevel
|
||
|
|
/// Path to the TOFU pin file (see `confirmServerIdentity` / docs/security.md §1.1).
|
||
|
|
/// nil = built-in relative default (only suitable for tests).
|
||
|
|
public let tofuStorePath: String?
|
||
|
|
|
||
|
|
public init(
|
||
|
|
clientName: String,
|
||
|
|
clientVersion: String,
|
||
|
|
logLevel: VoiceCatLogLevel = .info,
|
||
|
|
tofuStorePath: String? = nil
|
||
|
|
) {
|
||
|
|
self.clientName = clientName
|
||
|
|
self.clientVersion = clientVersion
|
||
|
|
self.logLevel = logLevel
|
||
|
|
self.tofuStorePath = tofuStorePath
|
||
|
|
}
|
||
|
|
}
|