Every injection point is a static property on ConnectionPoolConfiguration. Set them at app startup, before any other ConnectionPool API is used.
- Injecting a Custom Logger
- Injecting Encrypted Block List Storage
- Injecting Encrypted Remote Pool State Storage
struct MyLogger: ConnectionPoolLogger {
func log(
_ message: String,
level: PoolLogLevel,
category: PoolLogCategory,
file: String,
function: String,
line: Int
) {
print("[\(level.rawValue)] [\(category.rawValue)] \(message)")
}
}
// Set before using any ConnectionPool APIs
ConnectionPoolConfiguration.logger = MyLogger()struct SecureStorage: BlockListStorageProvider {
func save(_ data: Data, forKey key: String) throws {
// Write to Keychain or encrypted file
}
func load(forKey key: String) throws -> Data? {
// Read from Keychain or encrypted file
}
}
// Set at app startup
ConnectionPoolConfiguration.blockListStorageProvider = SecureStorage()// Same protocol as block list storage, so reuse your SecureStorage implementation
ConnectionPoolConfiguration.remotePoolStateStorageProvider = SecureStorage()When set, RemotePoolState persists through this provider instead of plain UserDefaults, preventing connection history (server URL, pool ID, host status) from being stored unencrypted.