// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!

// swiftlint:disable all
import Foundation

// Depending on the consumer's build setup, the low-level FFI code
// might be in a separate module, or it might be compiled inline into
// this module. This is a bit of light hackery to work with both.
#if canImport(nym_vpn_lib_typesFFI)
import nym_vpn_lib_typesFFI
#endif

fileprivate extension RustBuffer {
    // Allocate a new buffer, copying the contents of a `UInt8` array.
    init(bytes: [UInt8]) {
        let rbuf = bytes.withUnsafeBufferPointer { ptr in
            RustBuffer.from(ptr)
        }
        self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
    }

    static func empty() -> RustBuffer {
        RustBuffer(capacity: 0, len:0, data: nil)
    }

    static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
        try! rustCall { ffi_nym_vpn_lib_types_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
    }

    // Frees the buffer in place.
    // The buffer must not be used after this is called.
    func deallocate() {
        try! rustCall { ffi_nym_vpn_lib_types_rustbuffer_free(self, $0) }
    }
}

fileprivate extension ForeignBytes {
    init(bufferPointer: UnsafeBufferPointer<UInt8>) {
        self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
    }
}

// For every type used in the interface, we provide helper methods for conveniently
// lifting and lowering that type from C-compatible data, and for reading and writing
// values of that type in a buffer.

// Helper classes/extensions that don't change.
// Someday, this will be in a library of its own.

fileprivate extension Data {
    init(rustBuffer: RustBuffer) {
        self.init(
            bytesNoCopy: rustBuffer.data!,
            count: Int(rustBuffer.len),
            deallocator: .none
        )
    }
}

// Define reader functionality.  Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work.
//
// With external types, one swift source file needs to be able to call the read
// method on another source file's FfiConverter, but then what visibility
// should Reader have?
// - If Reader is fileprivate, then this means the read() must also
//   be fileprivate, which doesn't work with external types.
// - If Reader is internal/public, we'll get compile errors since both source
//   files will try define the same type.
//
// Instead, the read() method and these helper functions input a tuple of data

fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) {
    (data: data, offset: 0)
}

// Reads an integer at the current offset, in big-endian order, and advances
// the offset on success. Throws if reading the integer would move the
// offset past the end of the buffer.
fileprivate func readInt<T: FixedWidthInteger>(_ reader: inout (data: Data, offset: Data.Index)) throws -> T {
    let range = reader.offset..<reader.offset + MemoryLayout<T>.size
    guard reader.data.count >= range.upperBound else {
        throw UniffiInternalError.bufferOverflow
    }
    if T.self == UInt8.self {
        let value = reader.data[reader.offset]
        reader.offset += 1
        return value as! T
    }
    var value: T = 0
    let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)})
    reader.offset = range.upperBound
    return value.bigEndian
}

// Reads an arbitrary number of bytes, to be used to read
// raw bytes, this is useful when lifting strings
fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array<UInt8> {
    let range = reader.offset..<(reader.offset+count)
    guard reader.data.count >= range.upperBound else {
        throw UniffiInternalError.bufferOverflow
    }
    var value = [UInt8](repeating: 0, count: count)
    value.withUnsafeMutableBufferPointer({ buffer in
        reader.data.copyBytes(to: buffer, from: range)
    })
    reader.offset = range.upperBound
    return value
}

// Reads a float at the current offset.
fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float {
    return Float(bitPattern: try readInt(&reader))
}

// Reads a float at the current offset.
fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double {
    return Double(bitPattern: try readInt(&reader))
}

// Indicates if the offset has reached the end of the buffer.
fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool {
    return reader.offset < reader.data.count
}

// Define writer functionality.  Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work.  See the above discussion on Readers for details.

fileprivate func createWriter() -> [UInt8] {
    return []
}

fileprivate func writeBytes<S>(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 {
    writer.append(contentsOf: byteArr)
}

// Writes an integer in big-endian order.
//
// Warning: make sure what you are trying to write
// is in the correct type!
fileprivate func writeInt<T: FixedWidthInteger>(_ writer: inout [UInt8], _ value: T) {
    var value = value.bigEndian
    withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) }
}

fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) {
    writeInt(&writer, value.bitPattern)
}

fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
    writeInt(&writer, value.bitPattern)
}

// Protocol for types that transfer other types across the FFI. This is
// analogous to the Rust trait of the same name.
fileprivate protocol FfiConverter {
    associatedtype FfiType
    associatedtype SwiftType

    static func lift(_ value: FfiType) throws -> SwiftType
    static func lower(_ value: SwiftType) -> FfiType
    static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType
    static func write(_ value: SwiftType, into buf: inout [UInt8])
}

// Types conforming to `Primitive` pass themselves directly over the FFI.
fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }

extension FfiConverterPrimitive {
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public static func lift(_ value: FfiType) throws -> SwiftType {
        return value
    }

#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public static func lower(_ value: SwiftType) -> FfiType {
        return value
    }
}

// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`.
// Used for complex types where it's hard to write a custom lift/lower.
fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}

extension FfiConverterRustBuffer {
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public static func lift(_ buf: RustBuffer) throws -> SwiftType {
        var reader = createReader(data: Data(rustBuffer: buf))
        let value = try read(from: &reader)
        if hasRemaining(reader) {
            throw UniffiInternalError.incompleteData
        }
        buf.deallocate()
        return value
    }

#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public static func lower(_ value: SwiftType) -> RustBuffer {
          var writer = createWriter()
          write(value, into: &writer)
          return RustBuffer(bytes: writer)
    }
}
// An error type for FFI errors. These errors occur at the UniFFI level, not
// the library level.
fileprivate enum UniffiInternalError: LocalizedError {
    case bufferOverflow
    case incompleteData
    case unexpectedOptionalTag
    case unexpectedEnumCase
    case unexpectedNullPointer
    case unexpectedRustCallStatusCode
    case unexpectedRustCallError
    case unexpectedStaleHandle
    case rustPanic(_ message: String)

    public var errorDescription: String? {
        switch self {
        case .bufferOverflow: return "Reading the requested value would read past the end of the buffer"
        case .incompleteData: return "The buffer still has data after lifting its containing value"
        case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1"
        case .unexpectedEnumCase: return "Raw enum value doesn't match any cases"
        case .unexpectedNullPointer: return "Raw pointer value was null"
        case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code"
        case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified"
        case .unexpectedStaleHandle: return "The object in the handle map has been dropped already"
        case let .rustPanic(message): return message
        }
    }
}

fileprivate extension NSLock {
    func withLock<T>(f: () throws -> T) rethrows -> T {
        self.lock()
        defer { self.unlock() }
        return try f()
    }
}

fileprivate let CALL_SUCCESS: Int8 = 0
fileprivate let CALL_ERROR: Int8 = 1
fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2
fileprivate let CALL_CANCELLED: Int8 = 3

fileprivate extension RustCallStatus {
    init() {
        self.init(
            code: CALL_SUCCESS,
            errorBuf: RustBuffer.init(
                capacity: 0,
                len: 0,
                data: nil
            )
        )
    }
}

private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
    let neverThrow: ((RustBuffer) throws -> Never)? = nil
    return try makeRustCall(callback, errorHandler: neverThrow)
}

private func rustCallWithError<T, E: Swift.Error>(
    _ errorHandler: @escaping (RustBuffer) throws -> E,
    _ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
    try makeRustCall(callback, errorHandler: errorHandler)
}

private func makeRustCall<T, E: Swift.Error>(
    _ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
    errorHandler: ((RustBuffer) throws -> E)?
) throws -> T {
    uniffiEnsureNymVpnLibTypesInitialized()
    var callStatus = RustCallStatus.init()
    let returnedVal = callback(&callStatus)
    try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
    return returnedVal
}

private func uniffiCheckCallStatus<E: Swift.Error>(
    callStatus: RustCallStatus,
    errorHandler: ((RustBuffer) throws -> E)?
) throws {
    switch callStatus.code {
        case CALL_SUCCESS:
            return

        case CALL_ERROR:
            if let errorHandler = errorHandler {
                throw try errorHandler(callStatus.errorBuf)
            } else {
                callStatus.errorBuf.deallocate()
                throw UniffiInternalError.unexpectedRustCallError
            }

        case CALL_UNEXPECTED_ERROR:
            // When the rust code sees a panic, it tries to construct a RustBuffer
            // with the message.  But if that code panics, then it just sends back
            // an empty buffer.
            if callStatus.errorBuf.len > 0 {
                throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf))
            } else {
                callStatus.errorBuf.deallocate()
                throw UniffiInternalError.rustPanic("Rust panic")
            }

        case CALL_CANCELLED:
            fatalError("Cancellation not supported yet")

        default:
            throw UniffiInternalError.unexpectedRustCallStatusCode
    }
}

private func uniffiTraitInterfaceCall<T>(
    callStatus: UnsafeMutablePointer<RustCallStatus>,
    makeCall: () throws -> T,
    writeReturn: (T) -> ()
) {
    do {
        try writeReturn(makeCall())
    } catch let error {
        callStatus.pointee.code = CALL_UNEXPECTED_ERROR
        callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
    }
}

private func uniffiTraitInterfaceCallWithError<T, E>(
    callStatus: UnsafeMutablePointer<RustCallStatus>,
    makeCall: () throws -> T,
    writeReturn: (T) -> (),
    lowerError: (E) -> RustBuffer
) {
    do {
        try writeReturn(makeCall())
    } catch let error as E {
        callStatus.pointee.code = CALL_ERROR
        callStatus.pointee.errorBuf = lowerError(error)
    } catch {
        callStatus.pointee.code = CALL_UNEXPECTED_ERROR
        callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
    }
}
// Initial value and increment amount for handles. 
// These ensure that SWIFT handles always have the lowest bit set
fileprivate let UNIFFI_HANDLEMAP_INITIAL: UInt64 = 1
fileprivate let UNIFFI_HANDLEMAP_DELTA: UInt64 = 2

fileprivate final class UniffiHandleMap<T>: @unchecked Sendable {
    // All mutation happens with this lock held, which is why we implement @unchecked Sendable.
    private let lock = NSLock()
    private var map: [UInt64: T] = [:]
    private var currentHandle: UInt64 = UNIFFI_HANDLEMAP_INITIAL

    func insert(obj: T) -> UInt64 {
        lock.withLock {
            return doInsert(obj)
        }
    }

    // Low-level insert function, this assumes `lock` is held.
    private func doInsert(_ obj: T) -> UInt64 {
        let handle = currentHandle
        currentHandle += UNIFFI_HANDLEMAP_DELTA
        map[handle] = obj
        return handle
    }

     func get(handle: UInt64) throws -> T {
        try lock.withLock {
            guard let obj = map[handle] else {
                throw UniffiInternalError.unexpectedStaleHandle
            }
            return obj
        }
    }

     func clone(handle: UInt64) throws -> UInt64 {
        try lock.withLock {
            guard let obj = map[handle] else {
                throw UniffiInternalError.unexpectedStaleHandle
            }
            return doInsert(obj)
        }
    }

    @discardableResult
    func remove(handle: UInt64) throws -> T {
        try lock.withLock {
            guard let obj = map.removeValue(forKey: handle) else {
                throw UniffiInternalError.unexpectedStaleHandle
            }
            return obj
        }
    }

    var count: Int {
        get {
            map.count
        }
    }
}


// Public interface members begin here.


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterUInt8: FfiConverterPrimitive {
    typealias FfiType = UInt8
    typealias SwiftType = UInt8

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt8 {
        return try lift(readInt(&buf))
    }

    public static func write(_ value: UInt8, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterUInt16: FfiConverterPrimitive {
    typealias FfiType = UInt16
    typealias SwiftType = UInt16

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt16 {
        return try lift(readInt(&buf))
    }

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterUInt32: FfiConverterPrimitive {
    typealias FfiType = UInt32
    typealias SwiftType = UInt32

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 {
        return try lift(readInt(&buf))
    }

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
    typealias FfiType = UInt64
    typealias SwiftType = UInt64

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 {
        return try lift(readInt(&buf))
    }

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
    typealias FfiType = Int64
    typealias SwiftType = Int64

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int64 {
        return try lift(readInt(&buf))
    }

    public static func write(_ value: Int64, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterFloat: FfiConverterPrimitive {
    typealias FfiType = Float
    typealias SwiftType = Float

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Float {
        return try lift(readFloat(&buf))
    }

    public static func write(_ value: Float, into buf: inout [UInt8]) {
        writeFloat(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterDouble: FfiConverterPrimitive {
    typealias FfiType = Double
    typealias SwiftType = Double

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double {
        return try lift(readDouble(&buf))
    }

    public static func write(_ value: Double, into buf: inout [UInt8]) {
        writeDouble(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterBool : FfiConverter {
    typealias FfiType = Int8
    typealias SwiftType = Bool

    public static func lift(_ value: Int8) throws -> Bool {
        return value != 0
    }

    public static func lower(_ value: Bool) -> Int8 {
        return value ? 1 : 0
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool {
        return try lift(readInt(&buf))
    }

    public static func write(_ value: Bool, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterString: FfiConverter {
    typealias SwiftType = String
    typealias FfiType = RustBuffer

    public static func lift(_ value: RustBuffer) throws -> String {
        defer {
            value.deallocate()
        }
        if value.data == nil {
            return String()
        }
        let bytes = UnsafeBufferPointer<UInt8>(start: value.data!, count: Int(value.len))
        return String(bytes: bytes, encoding: String.Encoding.utf8)!
    }

    public static func lower(_ value: String) -> RustBuffer {
        return value.utf8CString.withUnsafeBufferPointer { ptr in
            // The swift string gives us int8_t, we want uint8_t.
            ptr.withMemoryRebound(to: UInt8.self) { ptr in
                // The swift string gives us a trailing null byte, we don't want it.
                let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
                return RustBuffer.from(buf)
            }
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String {
        let len: Int32 = try readInt(&buf)
        return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)!
    }

    public static func write(_ value: String, into buf: inout [UInt8]) {
        let len = Int32(value.utf8.count)
        writeInt(&buf, len)
        writeBytes(&buf, value.utf8)
    }
}




public protocol FeatureFlagsProtocol: AnyObject, Sendable {
    
    func getGroupFlag(groupName: String, flagName: String)  -> Bool?
    
    /**
     * If domain fronting is enabled or not, if set
     */
    func isDomainFrontingEnabled()  -> Bool?
    
    /**
     * If privy is enabled or not, if set
     */
    func isPrivyEnabled()  -> Bool?
    
    /**
     * If quic is enabled or not, if set
     */
    func isQuicEnabled()  -> Bool?
    
}
open class FeatureFlags: FeatureFlagsProtocol, @unchecked Sendable {
    fileprivate let handle: UInt64

    /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public struct NoHandle {
        public init() {}
    }

    // TODO: We'd like this to be `private` but for Swifty reasons,
    // we can't implement `FfiConverter` without making this `required` and we can't
    // make it `required` without making it `public`.
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    required public init(unsafeFromHandle handle: UInt64) {
        self.handle = handle
    }

    // This constructor can be used to instantiate a fake object.
    // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
    //
    // - Warning:
    //     Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public init(noHandle: NoHandle) {
        self.handle = 0
    }

#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public func uniffiCloneHandle() -> UInt64 {
        return try! rustCall { uniffi_nym_vpn_lib_types_fn_clone_featureflags(self.handle, $0) }
    }
    // No primary constructor declared for this class.

    deinit {
        try! rustCall { uniffi_nym_vpn_lib_types_fn_free_featureflags(handle, $0) }
    }

    

    
open func getGroupFlag(groupName: String, flagName: String) -> Bool?  {
    return try!  FfiConverterOptionBool.lift(try! rustCall() {
    uniffi_nym_vpn_lib_types_fn_method_featureflags_get_group_flag(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(groupName),
        FfiConverterString.lower(flagName),$0
    )
})
}
    
    /**
     * If domain fronting is enabled or not, if set
     */
open func isDomainFrontingEnabled() -> Bool?  {
    return try!  FfiConverterOptionBool.lift(try! rustCall() {
    uniffi_nym_vpn_lib_types_fn_method_featureflags_is_domain_fronting_enabled(
            self.uniffiCloneHandle(),$0
    )
})
}
    
    /**
     * If privy is enabled or not, if set
     */
open func isPrivyEnabled() -> Bool?  {
    return try!  FfiConverterOptionBool.lift(try! rustCall() {
    uniffi_nym_vpn_lib_types_fn_method_featureflags_is_privy_enabled(
            self.uniffiCloneHandle(),$0
    )
})
}
    
    /**
     * If quic is enabled or not, if set
     */
open func isQuicEnabled() -> Bool?  {
    return try!  FfiConverterOptionBool.lift(try! rustCall() {
    uniffi_nym_vpn_lib_types_fn_method_featureflags_is_quic_enabled(
            self.uniffiCloneHandle(),$0
    )
})
}
    

    
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeFeatureFlags: FfiConverter {
    typealias FfiType = UInt64
    typealias SwiftType = FeatureFlags

    public static func lift(_ handle: UInt64) throws -> FeatureFlags {
        return FeatureFlags(unsafeFromHandle: handle)
    }

    public static func lower(_ value: FeatureFlags) -> UInt64 {
        return value.uniffiCloneHandle()
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FeatureFlags {
        let handle: UInt64 = try readInt(&buf)
        return try lift(handle)
    }

    public static func write(_ value: FeatureFlags, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFeatureFlags_lift(_ handle: UInt64) throws -> FeatureFlags {
    return try FfiConverterTypeFeatureFlags.lift(handle)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFeatureFlags_lower(_ value: FeatureFlags) -> UInt64 {
    return FfiConverterTypeFeatureFlags.lower(value)
}




public struct AccountCommandResponse: Equatable, Hashable {
    public var error: AccountCommandError?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(error: AccountCommandError?) {
        self.error = error
    }

    
}

#if compiler(>=6)
extension AccountCommandResponse: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAccountCommandResponse: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountCommandResponse {
        return
            try AccountCommandResponse(
                error: FfiConverterOptionTypeAccountCommandError.read(from: &buf)
        )
    }

    public static func write(_ value: AccountCommandResponse, into buf: inout [UInt8]) {
        FfiConverterOptionTypeAccountCommandError.write(value.error, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountCommandResponse_lift(_ buf: RustBuffer) throws -> AccountCommandResponse {
    return try FfiConverterTypeAccountCommandResponse.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountCommandResponse_lower(_ value: AccountCommandResponse) -> RustBuffer {
    return FfiConverterTypeAccountCommandResponse.lower(value)
}


public struct ApiUrl: Equatable, Hashable {
    public var url: String
    public var frontHosts: [String]?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(url: String, frontHosts: [String]?) {
        self.url = url
        self.frontHosts = frontHosts
    }

    
}

#if compiler(>=6)
extension ApiUrl: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeApiUrl: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ApiUrl {
        return
            try ApiUrl(
                url: FfiConverterString.read(from: &buf), 
                frontHosts: FfiConverterOptionSequenceString.read(from: &buf)
        )
    }

    public static func write(_ value: ApiUrl, into buf: inout [UInt8]) {
        FfiConverterString.write(value.url, into: &buf)
        FfiConverterOptionSequenceString.write(value.frontHosts, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeApiUrl_lift(_ buf: RustBuffer) throws -> ApiUrl {
    return try FfiConverterTypeApiUrl.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeApiUrl_lower(_ value: ApiUrl) -> RustBuffer {
    return FfiConverterTypeApiUrl.lower(value)
}


public struct Asn: Equatable, Hashable {
    public var asn: String
    public var name: String
    public var kind: AsnKind

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(asn: String, name: String, kind: AsnKind) {
        self.asn = asn
        self.name = name
        self.kind = kind
    }

    
}

#if compiler(>=6)
extension Asn: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAsn: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Asn {
        return
            try Asn(
                asn: FfiConverterString.read(from: &buf), 
                name: FfiConverterString.read(from: &buf), 
                kind: FfiConverterTypeAsnKind.read(from: &buf)
        )
    }

    public static func write(_ value: Asn, into buf: inout [UInt8]) {
        FfiConverterString.write(value.asn, into: &buf)
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterTypeAsnKind.write(value.kind, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAsn_lift(_ buf: RustBuffer) throws -> Asn {
    return try FfiConverterTypeAsn.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAsn_lower(_ value: Asn) -> RustBuffer {
    return FfiConverterTypeAsn.lower(value)
}


public struct AvailableTickets: Equatable, Hashable {
    public var mixnetEntryTickets: UInt64
    public var mixnetEntryData: UInt64
    public var mixnetEntryDataSi: String
    public var mixnetExitTickets: UInt64
    public var mixnetExitData: UInt64
    public var mixnetExitDataSi: String
    public var vpnEntryTickets: UInt64
    public var vpnEntryData: UInt64
    public var vpnEntryDataSi: String
    public var vpnExitTickets: UInt64
    public var vpnExitData: UInt64
    public var vpnExitDataSi: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(mixnetEntryTickets: UInt64, mixnetEntryData: UInt64, mixnetEntryDataSi: String, mixnetExitTickets: UInt64, mixnetExitData: UInt64, mixnetExitDataSi: String, vpnEntryTickets: UInt64, vpnEntryData: UInt64, vpnEntryDataSi: String, vpnExitTickets: UInt64, vpnExitData: UInt64, vpnExitDataSi: String) {
        self.mixnetEntryTickets = mixnetEntryTickets
        self.mixnetEntryData = mixnetEntryData
        self.mixnetEntryDataSi = mixnetEntryDataSi
        self.mixnetExitTickets = mixnetExitTickets
        self.mixnetExitData = mixnetExitData
        self.mixnetExitDataSi = mixnetExitDataSi
        self.vpnEntryTickets = vpnEntryTickets
        self.vpnEntryData = vpnEntryData
        self.vpnEntryDataSi = vpnEntryDataSi
        self.vpnExitTickets = vpnExitTickets
        self.vpnExitData = vpnExitData
        self.vpnExitDataSi = vpnExitDataSi
    }

    
}

#if compiler(>=6)
extension AvailableTickets: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAvailableTickets: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AvailableTickets {
        return
            try AvailableTickets(
                mixnetEntryTickets: FfiConverterUInt64.read(from: &buf), 
                mixnetEntryData: FfiConverterUInt64.read(from: &buf), 
                mixnetEntryDataSi: FfiConverterString.read(from: &buf), 
                mixnetExitTickets: FfiConverterUInt64.read(from: &buf), 
                mixnetExitData: FfiConverterUInt64.read(from: &buf), 
                mixnetExitDataSi: FfiConverterString.read(from: &buf), 
                vpnEntryTickets: FfiConverterUInt64.read(from: &buf), 
                vpnEntryData: FfiConverterUInt64.read(from: &buf), 
                vpnEntryDataSi: FfiConverterString.read(from: &buf), 
                vpnExitTickets: FfiConverterUInt64.read(from: &buf), 
                vpnExitData: FfiConverterUInt64.read(from: &buf), 
                vpnExitDataSi: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: AvailableTickets, into buf: inout [UInt8]) {
        FfiConverterUInt64.write(value.mixnetEntryTickets, into: &buf)
        FfiConverterUInt64.write(value.mixnetEntryData, into: &buf)
        FfiConverterString.write(value.mixnetEntryDataSi, into: &buf)
        FfiConverterUInt64.write(value.mixnetExitTickets, into: &buf)
        FfiConverterUInt64.write(value.mixnetExitData, into: &buf)
        FfiConverterString.write(value.mixnetExitDataSi, into: &buf)
        FfiConverterUInt64.write(value.vpnEntryTickets, into: &buf)
        FfiConverterUInt64.write(value.vpnEntryData, into: &buf)
        FfiConverterString.write(value.vpnEntryDataSi, into: &buf)
        FfiConverterUInt64.write(value.vpnExitTickets, into: &buf)
        FfiConverterUInt64.write(value.vpnExitData, into: &buf)
        FfiConverterString.write(value.vpnExitDataSi, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAvailableTickets_lift(_ buf: RustBuffer) throws -> AvailableTickets {
    return try FfiConverterTypeAvailableTickets.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAvailableTickets_lower(_ value: AvailableTickets) -> RustBuffer {
    return FfiConverterTypeAvailableTickets.lower(value)
}


public struct BridgeAddress: Equatable, Hashable {
    /**
     * Local forwarder listen address
     */
    public var listenAddr: SocketAddr
    /**
     * Remote bridge address
     */
    public var remoteAddr: SocketAddr

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * Local forwarder listen address
         */listenAddr: SocketAddr, 
        /**
         * Remote bridge address
         */remoteAddr: SocketAddr) {
        self.listenAddr = listenAddr
        self.remoteAddr = remoteAddr
    }

    
}

#if compiler(>=6)
extension BridgeAddress: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBridgeAddress: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BridgeAddress {
        return
            try BridgeAddress(
                listenAddr: FfiConverterTypeSocketAddr.read(from: &buf), 
                remoteAddr: FfiConverterTypeSocketAddr.read(from: &buf)
        )
    }

    public static func write(_ value: BridgeAddress, into buf: inout [UInt8]) {
        FfiConverterTypeSocketAddr.write(value.listenAddr, into: &buf)
        FfiConverterTypeSocketAddr.write(value.remoteAddr, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBridgeAddress_lift(_ buf: RustBuffer) throws -> BridgeAddress {
    return try FfiConverterTypeBridgeAddress.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBridgeAddress_lower(_ value: BridgeAddress) -> RustBuffer {
    return FfiConverterTypeBridgeAddress.lower(value)
}


public struct BridgeInformation: Equatable, Hashable {
    public var version: String
    public var transports: [BridgeParameters]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(version: String, transports: [BridgeParameters]) {
        self.version = version
        self.transports = transports
    }

    
}

#if compiler(>=6)
extension BridgeInformation: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBridgeInformation: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BridgeInformation {
        return
            try BridgeInformation(
                version: FfiConverterString.read(from: &buf), 
                transports: FfiConverterSequenceTypeBridgeParameters.read(from: &buf)
        )
    }

    public static func write(_ value: BridgeInformation, into buf: inout [UInt8]) {
        FfiConverterString.write(value.version, into: &buf)
        FfiConverterSequenceTypeBridgeParameters.write(value.transports, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBridgeInformation_lift(_ buf: RustBuffer) throws -> BridgeInformation {
    return try FfiConverterTypeBridgeInformation.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBridgeInformation_lower(_ value: BridgeInformation) -> RustBuffer {
    return FfiConverterTypeBridgeInformation.lower(value)
}


public struct ChainDetails: Equatable, Hashable {
    public var bech32AccountPrefix: String
    public var mixDenom: DenomDetailsOwned
    public var stakeDenom: DenomDetailsOwned

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(bech32AccountPrefix: String, mixDenom: DenomDetailsOwned, stakeDenom: DenomDetailsOwned) {
        self.bech32AccountPrefix = bech32AccountPrefix
        self.mixDenom = mixDenom
        self.stakeDenom = stakeDenom
    }

    
}

#if compiler(>=6)
extension ChainDetails: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeChainDetails: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChainDetails {
        return
            try ChainDetails(
                bech32AccountPrefix: FfiConverterString.read(from: &buf), 
                mixDenom: FfiConverterTypeDenomDetailsOwned.read(from: &buf), 
                stakeDenom: FfiConverterTypeDenomDetailsOwned.read(from: &buf)
        )
    }

    public static func write(_ value: ChainDetails, into buf: inout [UInt8]) {
        FfiConverterString.write(value.bech32AccountPrefix, into: &buf)
        FfiConverterTypeDenomDetailsOwned.write(value.mixDenom, into: &buf)
        FfiConverterTypeDenomDetailsOwned.write(value.stakeDenom, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeChainDetails_lift(_ buf: RustBuffer) throws -> ChainDetails {
    return try FfiConverterTypeChainDetails.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeChainDetails_lower(_ value: ChainDetails) -> RustBuffer {
    return FfiConverterTypeChainDetails.lower(value)
}


public struct Coin: Equatable, Hashable {
    public var amount: U128
    public var denom: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(amount: U128, denom: String) {
        self.amount = amount
        self.denom = denom
    }

    
}

#if compiler(>=6)
extension Coin: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCoin: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Coin {
        return
            try Coin(
                amount: FfiConverterTypeu128.read(from: &buf), 
                denom: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: Coin, into buf: inout [UInt8]) {
        FfiConverterTypeu128.write(value.amount, into: &buf)
        FfiConverterString.write(value.denom, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCoin_lift(_ buf: RustBuffer) throws -> Coin {
    return try FfiConverterTypeCoin.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCoin_lower(_ value: Coin) -> RustBuffer {
    return FfiConverterTypeCoin.lower(value)
}


public struct ConnectionData: Equatable, Hashable {
    /**
     * Mixnet entry gateway.
     */
    public var entryGateway: GatewayLightInfo
    /**
     * Mixnet exit gateway.
     */
    public var exitGateway: GatewayLightInfo
    /**
     * When the tunnel connection was last established.
     */
    public var connectedAt: OffsetDateTime
    /**
     * Tunnel connection data.
     */
    public var tunnel: TunnelConnectionData

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * Mixnet entry gateway.
         */entryGateway: GatewayLightInfo, 
        /**
         * Mixnet exit gateway.
         */exitGateway: GatewayLightInfo, 
        /**
         * When the tunnel connection was last established.
         */connectedAt: OffsetDateTime, 
        /**
         * Tunnel connection data.
         */tunnel: TunnelConnectionData) {
        self.entryGateway = entryGateway
        self.exitGateway = exitGateway
        self.connectedAt = connectedAt
        self.tunnel = tunnel
    }

    
}

#if compiler(>=6)
extension ConnectionData: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeConnectionData: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ConnectionData {
        return
            try ConnectionData(
                entryGateway: FfiConverterTypeGatewayLightInfo.read(from: &buf), 
                exitGateway: FfiConverterTypeGatewayLightInfo.read(from: &buf), 
                connectedAt: FfiConverterTypeOffsetDateTime.read(from: &buf), 
                tunnel: FfiConverterTypeTunnelConnectionData.read(from: &buf)
        )
    }

    public static func write(_ value: ConnectionData, into buf: inout [UInt8]) {
        FfiConverterTypeGatewayLightInfo.write(value.entryGateway, into: &buf)
        FfiConverterTypeGatewayLightInfo.write(value.exitGateway, into: &buf)
        FfiConverterTypeOffsetDateTime.write(value.connectedAt, into: &buf)
        FfiConverterTypeTunnelConnectionData.write(value.tunnel, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeConnectionData_lift(_ buf: RustBuffer) throws -> ConnectionData {
    return try FfiConverterTypeConnectionData.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeConnectionData_lower(_ value: ConnectionData) -> RustBuffer {
    return FfiConverterTypeConnectionData.lower(value)
}


public struct ConnectionStatisticsEvent: Equatable, Hashable {
    public var rates: SphinxPacketRates

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rates: SphinxPacketRates) {
        self.rates = rates
    }

    
}

#if compiler(>=6)
extension ConnectionStatisticsEvent: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeConnectionStatisticsEvent: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ConnectionStatisticsEvent {
        return
            try ConnectionStatisticsEvent(
                rates: FfiConverterTypeSphinxPacketRates.read(from: &buf)
        )
    }

    public static func write(_ value: ConnectionStatisticsEvent, into buf: inout [UInt8]) {
        FfiConverterTypeSphinxPacketRates.write(value.rates, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeConnectionStatisticsEvent_lift(_ buf: RustBuffer) throws -> ConnectionStatisticsEvent {
    return try FfiConverterTypeConnectionStatisticsEvent.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeConnectionStatisticsEvent_lower(_ value: ConnectionStatisticsEvent) -> RustBuffer {
    return FfiConverterTypeConnectionStatisticsEvent.lower(value)
}


public struct Country: Equatable, Hashable {
    public var isoCode: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(isoCode: String) {
        self.isoCode = isoCode
    }

    
}

#if compiler(>=6)
extension Country: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCountry: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Country {
        return
            try Country(
                isoCode: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: Country, into buf: inout [UInt8]) {
        FfiConverterString.write(value.isoCode, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCountry_lift(_ buf: RustBuffer) throws -> Country {
    return try FfiConverterTypeCountry.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCountry_lower(_ value: Country) -> RustBuffer {
    return FfiConverterTypeCountry.lower(value)
}


public struct DecentralisedObtainTicketbooksRequest: Equatable, Hashable {
    public var amount: UInt64

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(amount: UInt64) {
        self.amount = amount
    }

    
}

#if compiler(>=6)
extension DecentralisedObtainTicketbooksRequest: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDecentralisedObtainTicketbooksRequest: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DecentralisedObtainTicketbooksRequest {
        return
            try DecentralisedObtainTicketbooksRequest(
                amount: FfiConverterUInt64.read(from: &buf)
        )
    }

    public static func write(_ value: DecentralisedObtainTicketbooksRequest, into buf: inout [UInt8]) {
        FfiConverterUInt64.write(value.amount, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDecentralisedObtainTicketbooksRequest_lift(_ buf: RustBuffer) throws -> DecentralisedObtainTicketbooksRequest {
    return try FfiConverterTypeDecentralisedObtainTicketbooksRequest.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDecentralisedObtainTicketbooksRequest_lower(_ value: DecentralisedObtainTicketbooksRequest) -> RustBuffer {
    return FfiConverterTypeDecentralisedObtainTicketbooksRequest.lower(value)
}


public struct DenomDetailsOwned: Equatable, Hashable {
    public var base: String
    public var display: String
    public var displayExponent: UInt32

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(base: String, display: String, displayExponent: UInt32) {
        self.base = base
        self.display = display
        self.displayExponent = displayExponent
    }

    
}

#if compiler(>=6)
extension DenomDetailsOwned: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDenomDetailsOwned: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DenomDetailsOwned {
        return
            try DenomDetailsOwned(
                base: FfiConverterString.read(from: &buf), 
                display: FfiConverterString.read(from: &buf), 
                displayExponent: FfiConverterUInt32.read(from: &buf)
        )
    }

    public static func write(_ value: DenomDetailsOwned, into buf: inout [UInt8]) {
        FfiConverterString.write(value.base, into: &buf)
        FfiConverterString.write(value.display, into: &buf)
        FfiConverterUInt32.write(value.displayExponent, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDenomDetailsOwned_lift(_ buf: RustBuffer) throws -> DenomDetailsOwned {
    return try FfiConverterTypeDenomDetailsOwned.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDenomDetailsOwned_lower(_ value: DenomDetailsOwned) -> RustBuffer {
    return FfiConverterTypeDenomDetailsOwned.lower(value)
}


/**
 * SOCKS5 enable request
 */
public struct EnableSocks5Request: Equatable, Hashable {
    public var socks5Settings: Socks5Settings
    public var httpRpcSettings: HttpRpcSettings
    public var exitPoint: ExitPoint

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(socks5Settings: Socks5Settings, httpRpcSettings: HttpRpcSettings, exitPoint: ExitPoint) {
        self.socks5Settings = socks5Settings
        self.httpRpcSettings = httpRpcSettings
        self.exitPoint = exitPoint
    }

    
}

#if compiler(>=6)
extension EnableSocks5Request: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeEnableSocks5Request: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EnableSocks5Request {
        return
            try EnableSocks5Request(
                socks5Settings: FfiConverterTypeSocks5Settings.read(from: &buf), 
                httpRpcSettings: FfiConverterTypeHttpRpcSettings.read(from: &buf), 
                exitPoint: FfiConverterTypeExitPoint.read(from: &buf)
        )
    }

    public static func write(_ value: EnableSocks5Request, into buf: inout [UInt8]) {
        FfiConverterTypeSocks5Settings.write(value.socks5Settings, into: &buf)
        FfiConverterTypeHttpRpcSettings.write(value.httpRpcSettings, into: &buf)
        FfiConverterTypeExitPoint.write(value.exitPoint, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEnableSocks5Request_lift(_ buf: RustBuffer) throws -> EnableSocks5Request {
    return try FfiConverterTypeEnableSocks5Request.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEnableSocks5Request_lower(_ value: EnableSocks5Request) -> RustBuffer {
    return FfiConverterTypeEnableSocks5Request.lower(value)
}


public struct Entry: Equatable, Hashable {
    public var canConnect: Bool
    public var canRoute: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(canConnect: Bool, canRoute: Bool) {
        self.canConnect = canConnect
        self.canRoute = canRoute
    }

    
}

#if compiler(>=6)
extension Entry: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeEntry: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Entry {
        return
            try Entry(
                canConnect: FfiConverterBool.read(from: &buf), 
                canRoute: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: Entry, into buf: inout [UInt8]) {
        FfiConverterBool.write(value.canConnect, into: &buf)
        FfiConverterBool.write(value.canRoute, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEntry_lift(_ buf: RustBuffer) throws -> Entry {
    return try FfiConverterTypeEntry.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEntry_lower(_ value: Entry) -> RustBuffer {
    return FfiConverterTypeEntry.lower(value)
}


public struct EstablishConnectionData: Equatable, Hashable {
    /**
     * Mixnet entry gateway.
     */
    public var entryGateway: GatewayLightInfo
    /**
     * Mixnet exit gateway.
     */
    public var exitGateway: GatewayLightInfo
    /**
     * Tunnel connection data.
     * Becomes available once tunnel connection is initiated.
     */
    public var tunnel: TunnelConnectionData?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * Mixnet entry gateway.
         */entryGateway: GatewayLightInfo, 
        /**
         * Mixnet exit gateway.
         */exitGateway: GatewayLightInfo, 
        /**
         * Tunnel connection data.
         * Becomes available once tunnel connection is initiated.
         */tunnel: TunnelConnectionData?) {
        self.entryGateway = entryGateway
        self.exitGateway = exitGateway
        self.tunnel = tunnel
    }

    
}

#if compiler(>=6)
extension EstablishConnectionData: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeEstablishConnectionData: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EstablishConnectionData {
        return
            try EstablishConnectionData(
                entryGateway: FfiConverterTypeGatewayLightInfo.read(from: &buf), 
                exitGateway: FfiConverterTypeGatewayLightInfo.read(from: &buf), 
                tunnel: FfiConverterOptionTypeTunnelConnectionData.read(from: &buf)
        )
    }

    public static func write(_ value: EstablishConnectionData, into buf: inout [UInt8]) {
        FfiConverterTypeGatewayLightInfo.write(value.entryGateway, into: &buf)
        FfiConverterTypeGatewayLightInfo.write(value.exitGateway, into: &buf)
        FfiConverterOptionTypeTunnelConnectionData.write(value.tunnel, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEstablishConnectionData_lift(_ buf: RustBuffer) throws -> EstablishConnectionData {
    return try FfiConverterTypeEstablishConnectionData.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEstablishConnectionData_lower(_ value: EstablishConnectionData) -> RustBuffer {
    return FfiConverterTypeEstablishConnectionData.lower(value)
}


public struct Exit: Equatable, Hashable {
    public var canConnect: Bool
    public var canRouteIpV4: Bool
    public var canRouteIpExternalV4: Bool
    public var canRouteIpV6: Bool
    public var canRouteIpExternalV6: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(canConnect: Bool, canRouteIpV4: Bool, canRouteIpExternalV4: Bool, canRouteIpV6: Bool, canRouteIpExternalV6: Bool) {
        self.canConnect = canConnect
        self.canRouteIpV4 = canRouteIpV4
        self.canRouteIpExternalV4 = canRouteIpExternalV4
        self.canRouteIpV6 = canRouteIpV6
        self.canRouteIpExternalV6 = canRouteIpExternalV6
    }

    
}

#if compiler(>=6)
extension Exit: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeExit: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Exit {
        return
            try Exit(
                canConnect: FfiConverterBool.read(from: &buf), 
                canRouteIpV4: FfiConverterBool.read(from: &buf), 
                canRouteIpExternalV4: FfiConverterBool.read(from: &buf), 
                canRouteIpV6: FfiConverterBool.read(from: &buf), 
                canRouteIpExternalV6: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: Exit, into buf: inout [UInt8]) {
        FfiConverterBool.write(value.canConnect, into: &buf)
        FfiConverterBool.write(value.canRouteIpV4, into: &buf)
        FfiConverterBool.write(value.canRouteIpExternalV4, into: &buf)
        FfiConverterBool.write(value.canRouteIpV6, into: &buf)
        FfiConverterBool.write(value.canRouteIpExternalV6, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeExit_lift(_ buf: RustBuffer) throws -> Exit {
    return try FfiConverterTypeExit.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeExit_lower(_ value: Exit) -> RustBuffer {
    return FfiConverterTypeExit.lower(value)
}


public struct Gateway: Equatable, Hashable {
    public var identityKey: String
    public var name: String
    public var description: String?
    public var location: Location?
    public var lastProbe: Probe?
    public var mixnetPerformance: UInt8?
    public var bridgeParams: BridgeInformation?
    public var performance: Performance?
    public var exitIpv4s: [Ipv4Addr]
    public var exitIpv6s: [Ipv6Addr]
    public var buildVersion: String?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(identityKey: String, name: String, description: String?, location: Location?, lastProbe: Probe?, mixnetPerformance: UInt8?, bridgeParams: BridgeInformation?, performance: Performance?, exitIpv4s: [Ipv4Addr], exitIpv6s: [Ipv6Addr], buildVersion: String?) {
        self.identityKey = identityKey
        self.name = name
        self.description = description
        self.location = location
        self.lastProbe = lastProbe
        self.mixnetPerformance = mixnetPerformance
        self.bridgeParams = bridgeParams
        self.performance = performance
        self.exitIpv4s = exitIpv4s
        self.exitIpv6s = exitIpv6s
        self.buildVersion = buildVersion
    }

    
}

#if compiler(>=6)
extension Gateway: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGateway: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Gateway {
        return
            try Gateway(
                identityKey: FfiConverterString.read(from: &buf), 
                name: FfiConverterString.read(from: &buf), 
                description: FfiConverterOptionString.read(from: &buf), 
                location: FfiConverterOptionTypeLocation.read(from: &buf), 
                lastProbe: FfiConverterOptionTypeProbe.read(from: &buf), 
                mixnetPerformance: FfiConverterOptionUInt8.read(from: &buf), 
                bridgeParams: FfiConverterOptionTypeBridgeInformation.read(from: &buf), 
                performance: FfiConverterOptionTypePerformance.read(from: &buf), 
                exitIpv4s: FfiConverterSequenceTypeIpv4Addr.read(from: &buf), 
                exitIpv6s: FfiConverterSequenceTypeIpv6Addr.read(from: &buf), 
                buildVersion: FfiConverterOptionString.read(from: &buf)
        )
    }

    public static func write(_ value: Gateway, into buf: inout [UInt8]) {
        FfiConverterString.write(value.identityKey, into: &buf)
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterOptionString.write(value.description, into: &buf)
        FfiConverterOptionTypeLocation.write(value.location, into: &buf)
        FfiConverterOptionTypeProbe.write(value.lastProbe, into: &buf)
        FfiConverterOptionUInt8.write(value.mixnetPerformance, into: &buf)
        FfiConverterOptionTypeBridgeInformation.write(value.bridgeParams, into: &buf)
        FfiConverterOptionTypePerformance.write(value.performance, into: &buf)
        FfiConverterSequenceTypeIpv4Addr.write(value.exitIpv4s, into: &buf)
        FfiConverterSequenceTypeIpv6Addr.write(value.exitIpv6s, into: &buf)
        FfiConverterOptionString.write(value.buildVersion, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGateway_lift(_ buf: RustBuffer) throws -> Gateway {
    return try FfiConverterTypeGateway.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGateway_lower(_ value: Gateway) -> RustBuffer {
    return FfiConverterTypeGateway.lower(value)
}


public struct GatewayId: Equatable, Hashable {
    public var id: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: String) {
        self.id = id
    }

    
}

#if compiler(>=6)
extension GatewayId: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGatewayId: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GatewayId {
        return
            try GatewayId(
                id: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: GatewayId, into buf: inout [UInt8]) {
        FfiConverterString.write(value.id, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayId_lift(_ buf: RustBuffer) throws -> GatewayId {
    return try FfiConverterTypeGatewayId.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayId_lower(_ value: GatewayId) -> RustBuffer {
    return FfiConverterTypeGatewayId.lower(value)
}


public struct GatewayLightInfo: Equatable, Hashable {
    public var id: String
    public var countryCode: String?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: String, countryCode: String?) {
        self.id = id
        self.countryCode = countryCode
    }

    
}

#if compiler(>=6)
extension GatewayLightInfo: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGatewayLightInfo: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GatewayLightInfo {
        return
            try GatewayLightInfo(
                id: FfiConverterString.read(from: &buf), 
                countryCode: FfiConverterOptionString.read(from: &buf)
        )
    }

    public static func write(_ value: GatewayLightInfo, into buf: inout [UInt8]) {
        FfiConverterString.write(value.id, into: &buf)
        FfiConverterOptionString.write(value.countryCode, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayLightInfo_lift(_ buf: RustBuffer) throws -> GatewayLightInfo {
    return try FfiConverterTypeGatewayLightInfo.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayLightInfo_lower(_ value: GatewayLightInfo) -> RustBuffer {
    return FfiConverterTypeGatewayLightInfo.lower(value)
}


public struct GetDeeplinkParams: Equatable, Hashable {
    public var client: DeeplinkClient
    public var locale: String
    public var kind: DeeplinkKind
    public var name: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(client: DeeplinkClient, locale: String, kind: DeeplinkKind, name: String) {
        self.client = client
        self.locale = locale
        self.kind = kind
        self.name = name
    }

    
}

#if compiler(>=6)
extension GetDeeplinkParams: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGetDeeplinkParams: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GetDeeplinkParams {
        return
            try GetDeeplinkParams(
                client: FfiConverterTypeDeeplinkClient.read(from: &buf), 
                locale: FfiConverterString.read(from: &buf), 
                kind: FfiConverterTypeDeeplinkKind.read(from: &buf), 
                name: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: GetDeeplinkParams, into buf: inout [UInt8]) {
        FfiConverterTypeDeeplinkClient.write(value.client, into: &buf)
        FfiConverterString.write(value.locale, into: &buf)
        FfiConverterTypeDeeplinkKind.write(value.kind, into: &buf)
        FfiConverterString.write(value.name, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGetDeeplinkParams_lift(_ buf: RustBuffer) throws -> GetDeeplinkParams {
    return try FfiConverterTypeGetDeeplinkParams.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGetDeeplinkParams_lower(_ value: GetDeeplinkParams) -> RustBuffer {
    return FfiConverterTypeGetDeeplinkParams.lower(value)
}


/**
 * HTTP RPC proxy settings
 */
public struct HttpRpcSettings: Equatable, Hashable {
    /**
     * HTTP RPC listen address, e.g., 127.0.0.1:8545
     */
    public var listenAddress: SocketAddr?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * HTTP RPC listen address, e.g., 127.0.0.1:8545
         */listenAddress: SocketAddr?) {
        self.listenAddress = listenAddress
    }

    
}

#if compiler(>=6)
extension HttpRpcSettings: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeHttpRpcSettings: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HttpRpcSettings {
        return
            try HttpRpcSettings(
                listenAddress: FfiConverterOptionTypeSocketAddr.read(from: &buf)
        )
    }

    public static func write(_ value: HttpRpcSettings, into buf: inout [UInt8]) {
        FfiConverterOptionTypeSocketAddr.write(value.listenAddress, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHttpRpcSettings_lift(_ buf: RustBuffer) throws -> HttpRpcSettings {
    return try FfiConverterTypeHttpRpcSettings.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHttpRpcSettings_lower(_ value: HttpRpcSettings) -> RustBuffer {
    return FfiConverterTypeHttpRpcSettings.lower(value)
}


public struct ListGatewaysOptions: Equatable, Hashable {
    public var gwType: GatewayType
    public var userAgent: UserAgent?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(gwType: GatewayType, userAgent: UserAgent?) {
        self.gwType = gwType
        self.userAgent = userAgent
    }

    
}

#if compiler(>=6)
extension ListGatewaysOptions: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeListGatewaysOptions: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ListGatewaysOptions {
        return
            try ListGatewaysOptions(
                gwType: FfiConverterTypeGatewayType.read(from: &buf), 
                userAgent: FfiConverterOptionTypeUserAgent.read(from: &buf)
        )
    }

    public static func write(_ value: ListGatewaysOptions, into buf: inout [UInt8]) {
        FfiConverterTypeGatewayType.write(value.gwType, into: &buf)
        FfiConverterOptionTypeUserAgent.write(value.userAgent, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeListGatewaysOptions_lift(_ buf: RustBuffer) throws -> ListGatewaysOptions {
    return try FfiConverterTypeListGatewaysOptions.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeListGatewaysOptions_lower(_ value: ListGatewaysOptions) -> RustBuffer {
    return FfiConverterTypeListGatewaysOptions.lower(value)
}


public struct Location: Equatable, Hashable {
    public var twoLetterIsoCountryCode: String
    public var latitude: Double
    public var longitude: Double
    public var city: String
    public var region: String
    public var asn: Asn?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(twoLetterIsoCountryCode: String, latitude: Double, longitude: Double, city: String, region: String, asn: Asn?) {
        self.twoLetterIsoCountryCode = twoLetterIsoCountryCode
        self.latitude = latitude
        self.longitude = longitude
        self.city = city
        self.region = region
        self.asn = asn
    }

    
}

#if compiler(>=6)
extension Location: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeLocation: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Location {
        return
            try Location(
                twoLetterIsoCountryCode: FfiConverterString.read(from: &buf), 
                latitude: FfiConverterDouble.read(from: &buf), 
                longitude: FfiConverterDouble.read(from: &buf), 
                city: FfiConverterString.read(from: &buf), 
                region: FfiConverterString.read(from: &buf), 
                asn: FfiConverterOptionTypeAsn.read(from: &buf)
        )
    }

    public static func write(_ value: Location, into buf: inout [UInt8]) {
        FfiConverterString.write(value.twoLetterIsoCountryCode, into: &buf)
        FfiConverterDouble.write(value.latitude, into: &buf)
        FfiConverterDouble.write(value.longitude, into: &buf)
        FfiConverterString.write(value.city, into: &buf)
        FfiConverterString.write(value.region, into: &buf)
        FfiConverterOptionTypeAsn.write(value.asn, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLocation_lift(_ buf: RustBuffer) throws -> Location {
    return try FfiConverterTypeLocation.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLocation_lower(_ value: Location) -> RustBuffer {
    return FfiConverterTypeLocation.lower(value)
}


public struct LogPath: Equatable, Hashable {
    public var dir: PathBuf
    public var filename: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(dir: PathBuf, filename: String) {
        self.dir = dir
        self.filename = filename
    }

    
}

#if compiler(>=6)
extension LogPath: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeLogPath: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogPath {
        return
            try LogPath(
                dir: FfiConverterTypePathBuf.read(from: &buf), 
                filename: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: LogPath, into buf: inout [UInt8]) {
        FfiConverterTypePathBuf.write(value.dir, into: &buf)
        FfiConverterString.write(value.filename, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLogPath_lift(_ buf: RustBuffer) throws -> LogPath {
    return try FfiConverterTypeLogPath.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLogPath_lower(_ value: LogPath) -> RustBuffer {
    return FfiConverterTypeLogPath.lower(value)
}


public struct LookupGatewayFilters: Equatable, Hashable {
    public var gwType: GatewayType
    public var filters: [GatewayFilter]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(gwType: GatewayType, filters: [GatewayFilter]) {
        self.gwType = gwType
        self.filters = filters
    }

    
}

#if compiler(>=6)
extension LookupGatewayFilters: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeLookupGatewayFilters: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LookupGatewayFilters {
        return
            try LookupGatewayFilters(
                gwType: FfiConverterTypeGatewayType.read(from: &buf), 
                filters: FfiConverterSequenceTypeGatewayFilter.read(from: &buf)
        )
    }

    public static func write(_ value: LookupGatewayFilters, into buf: inout [UInt8]) {
        FfiConverterTypeGatewayType.write(value.gwType, into: &buf)
        FfiConverterSequenceTypeGatewayFilter.write(value.filters, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLookupGatewayFilters_lift(_ buf: RustBuffer) throws -> LookupGatewayFilters {
    return try FfiConverterTypeLookupGatewayFilters.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLookupGatewayFilters_lower(_ value: LookupGatewayFilters) -> RustBuffer {
    return FfiConverterTypeLookupGatewayFilters.lower(value)
}


public struct MixnetConnectionData: Equatable, Hashable {
    public var nymAddress: NymAddress
    public var exitIpr: NymAddress
    public var entryIp: IpAddr
    public var exitIp: IpAddr
    public var ipv4: Ipv4Addr
    public var ipv6: Ipv6Addr?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(nymAddress: NymAddress, exitIpr: NymAddress, entryIp: IpAddr, exitIp: IpAddr, ipv4: Ipv4Addr, ipv6: Ipv6Addr?) {
        self.nymAddress = nymAddress
        self.exitIpr = exitIpr
        self.entryIp = entryIp
        self.exitIp = exitIp
        self.ipv4 = ipv4
        self.ipv6 = ipv6
    }

    
}

#if compiler(>=6)
extension MixnetConnectionData: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMixnetConnectionData: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MixnetConnectionData {
        return
            try MixnetConnectionData(
                nymAddress: FfiConverterTypeNymAddress.read(from: &buf), 
                exitIpr: FfiConverterTypeNymAddress.read(from: &buf), 
                entryIp: FfiConverterTypeIpAddr.read(from: &buf), 
                exitIp: FfiConverterTypeIpAddr.read(from: &buf), 
                ipv4: FfiConverterTypeIpv4Addr.read(from: &buf), 
                ipv6: FfiConverterOptionTypeIpv6Addr.read(from: &buf)
        )
    }

    public static func write(_ value: MixnetConnectionData, into buf: inout [UInt8]) {
        FfiConverterTypeNymAddress.write(value.nymAddress, into: &buf)
        FfiConverterTypeNymAddress.write(value.exitIpr, into: &buf)
        FfiConverterTypeIpAddr.write(value.entryIp, into: &buf)
        FfiConverterTypeIpAddr.write(value.exitIp, into: &buf)
        FfiConverterTypeIpv4Addr.write(value.ipv4, into: &buf)
        FfiConverterOptionTypeIpv6Addr.write(value.ipv6, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMixnetConnectionData_lift(_ buf: RustBuffer) throws -> MixnetConnectionData {
    return try FfiConverterTypeMixnetConnectionData.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMixnetConnectionData_lower(_ value: MixnetConnectionData) -> RustBuffer {
    return FfiConverterTypeMixnetConnectionData.lower(value)
}


public struct MixnetTrafficConfig: Equatable, Hashable {
    public var poissonParameterForLoopCoverStream: UInt32?
    public var averagePacketDelay: UInt32?
    public var messageSendingAverageDelay: UInt32?
    public var disablePoissonRate: Bool
    public var disableBackgroundCoverTraffic: Bool
    public var minMixnodePerformance: UInt8?
    public var minGatewayMixnetPerformance: UInt8?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(poissonParameterForLoopCoverStream: UInt32?, averagePacketDelay: UInt32?, messageSendingAverageDelay: UInt32?, disablePoissonRate: Bool, disableBackgroundCoverTraffic: Bool, minMixnodePerformance: UInt8?, minGatewayMixnetPerformance: UInt8?) {
        self.poissonParameterForLoopCoverStream = poissonParameterForLoopCoverStream
        self.averagePacketDelay = averagePacketDelay
        self.messageSendingAverageDelay = messageSendingAverageDelay
        self.disablePoissonRate = disablePoissonRate
        self.disableBackgroundCoverTraffic = disableBackgroundCoverTraffic
        self.minMixnodePerformance = minMixnodePerformance
        self.minGatewayMixnetPerformance = minGatewayMixnetPerformance
    }

    
}

#if compiler(>=6)
extension MixnetTrafficConfig: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMixnetTrafficConfig: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MixnetTrafficConfig {
        return
            try MixnetTrafficConfig(
                poissonParameterForLoopCoverStream: FfiConverterOptionUInt32.read(from: &buf), 
                averagePacketDelay: FfiConverterOptionUInt32.read(from: &buf), 
                messageSendingAverageDelay: FfiConverterOptionUInt32.read(from: &buf), 
                disablePoissonRate: FfiConverterBool.read(from: &buf), 
                disableBackgroundCoverTraffic: FfiConverterBool.read(from: &buf), 
                minMixnodePerformance: FfiConverterOptionUInt8.read(from: &buf), 
                minGatewayMixnetPerformance: FfiConverterOptionUInt8.read(from: &buf)
        )
    }

    public static func write(_ value: MixnetTrafficConfig, into buf: inout [UInt8]) {
        FfiConverterOptionUInt32.write(value.poissonParameterForLoopCoverStream, into: &buf)
        FfiConverterOptionUInt32.write(value.averagePacketDelay, into: &buf)
        FfiConverterOptionUInt32.write(value.messageSendingAverageDelay, into: &buf)
        FfiConverterBool.write(value.disablePoissonRate, into: &buf)
        FfiConverterBool.write(value.disableBackgroundCoverTraffic, into: &buf)
        FfiConverterOptionUInt8.write(value.minMixnodePerformance, into: &buf)
        FfiConverterOptionUInt8.write(value.minGatewayMixnetPerformance, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMixnetTrafficConfig_lift(_ buf: RustBuffer) throws -> MixnetTrafficConfig {
    return try FfiConverterTypeMixnetTrafficConfig.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMixnetTrafficConfig_lower(_ value: MixnetTrafficConfig) -> RustBuffer {
    return FfiConverterTypeMixnetTrafficConfig.lower(value)
}


public struct Network {
    public var nymNetwork: NymNetworkDetails
    public var nyxdUrl: String
    public var nymVpnNetwork: NymVpnNetwork
    public var featureFlags: FeatureFlags?
    public var systemConfiguration: SystemConfiguration?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(nymNetwork: NymNetworkDetails, nyxdUrl: String, nymVpnNetwork: NymVpnNetwork, featureFlags: FeatureFlags?, systemConfiguration: SystemConfiguration?) {
        self.nymNetwork = nymNetwork
        self.nyxdUrl = nyxdUrl
        self.nymVpnNetwork = nymVpnNetwork
        self.featureFlags = featureFlags
        self.systemConfiguration = systemConfiguration
    }

    
}

#if compiler(>=6)
extension Network: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNetwork: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Network {
        return
            try Network(
                nymNetwork: FfiConverterTypeNymNetworkDetails.read(from: &buf), 
                nyxdUrl: FfiConverterString.read(from: &buf), 
                nymVpnNetwork: FfiConverterTypeNymVpnNetwork.read(from: &buf), 
                featureFlags: FfiConverterOptionTypeFeatureFlags.read(from: &buf), 
                systemConfiguration: FfiConverterOptionTypeSystemConfiguration.read(from: &buf)
        )
    }

    public static func write(_ value: Network, into buf: inout [UInt8]) {
        FfiConverterTypeNymNetworkDetails.write(value.nymNetwork, into: &buf)
        FfiConverterString.write(value.nyxdUrl, into: &buf)
        FfiConverterTypeNymVpnNetwork.write(value.nymVpnNetwork, into: &buf)
        FfiConverterOptionTypeFeatureFlags.write(value.featureFlags, into: &buf)
        FfiConverterOptionTypeSystemConfiguration.write(value.systemConfiguration, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetwork_lift(_ buf: RustBuffer) throws -> Network {
    return try FfiConverterTypeNetwork.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetwork_lower(_ value: Network) -> RustBuffer {
    return FfiConverterTypeNetwork.lower(value)
}


public struct NetworkCompatibility: Equatable, Hashable {
    public var core: String
    public var ios: String
    public var macos: String
    public var tauri: String
    public var android: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(core: String, ios: String, macos: String, tauri: String, android: String) {
        self.core = core
        self.ios = ios
        self.macos = macos
        self.tauri = tauri
        self.android = android
    }

    
}

#if compiler(>=6)
extension NetworkCompatibility: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNetworkCompatibility: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NetworkCompatibility {
        return
            try NetworkCompatibility(
                core: FfiConverterString.read(from: &buf), 
                ios: FfiConverterString.read(from: &buf), 
                macos: FfiConverterString.read(from: &buf), 
                tauri: FfiConverterString.read(from: &buf), 
                android: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: NetworkCompatibility, into buf: inout [UInt8]) {
        FfiConverterString.write(value.core, into: &buf)
        FfiConverterString.write(value.ios, into: &buf)
        FfiConverterString.write(value.macos, into: &buf)
        FfiConverterString.write(value.tauri, into: &buf)
        FfiConverterString.write(value.android, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetworkCompatibility_lift(_ buf: RustBuffer) throws -> NetworkCompatibility {
    return try FfiConverterTypeNetworkCompatibility.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetworkCompatibility_lower(_ value: NetworkCompatibility) -> RustBuffer {
    return FfiConverterTypeNetworkCompatibility.lower(value)
}


public struct NetworkStatisticsConfig: Equatable, Hashable {
    /**
     * Is stats reporting enabled
     */
    public var enabled: Bool
    /**
     * Allow statistics sending, even if not connected to the mixnet/vpn
     */
    public var allowDisconnected: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * Is stats reporting enabled
         */enabled: Bool, 
        /**
         * Allow statistics sending, even if not connected to the mixnet/vpn
         */allowDisconnected: Bool) {
        self.enabled = enabled
        self.allowDisconnected = allowDisconnected
    }

    
}

#if compiler(>=6)
extension NetworkStatisticsConfig: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNetworkStatisticsConfig: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NetworkStatisticsConfig {
        return
            try NetworkStatisticsConfig(
                enabled: FfiConverterBool.read(from: &buf), 
                allowDisconnected: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: NetworkStatisticsConfig, into buf: inout [UInt8]) {
        FfiConverterBool.write(value.enabled, into: &buf)
        FfiConverterBool.write(value.allowDisconnected, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetworkStatisticsConfig_lift(_ buf: RustBuffer) throws -> NetworkStatisticsConfig {
    return try FfiConverterTypeNetworkStatisticsConfig.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetworkStatisticsConfig_lower(_ value: NetworkStatisticsConfig) -> RustBuffer {
    return FfiConverterTypeNetworkStatisticsConfig.lower(value)
}


public struct NetworkStatisticsIdentity: Equatable, Hashable {
    /**
     * Seed used to generate the id
     */
    public var seed: String
    /**
     * Actual ID used
     */
    public var id: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * Seed used to generate the id
         */seed: String, 
        /**
         * Actual ID used
         */id: String) {
        self.seed = seed
        self.id = id
    }

    
}

#if compiler(>=6)
extension NetworkStatisticsIdentity: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNetworkStatisticsIdentity: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NetworkStatisticsIdentity {
        return
            try NetworkStatisticsIdentity(
                seed: FfiConverterString.read(from: &buf), 
                id: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: NetworkStatisticsIdentity, into buf: inout [UInt8]) {
        FfiConverterString.write(value.seed, into: &buf)
        FfiConverterString.write(value.id, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetworkStatisticsIdentity_lift(_ buf: RustBuffer) throws -> NetworkStatisticsIdentity {
    return try FfiConverterTypeNetworkStatisticsIdentity.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNetworkStatisticsIdentity_lower(_ value: NetworkStatisticsIdentity) -> RustBuffer {
    return FfiConverterTypeNetworkStatisticsIdentity.lower(value)
}


public struct NymAddress: Equatable, Hashable {
    public var nymAddress: String
    public var gatewayId: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(nymAddress: String, gatewayId: String) {
        self.nymAddress = nymAddress
        self.gatewayId = gatewayId
    }

    
}

#if compiler(>=6)
extension NymAddress: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymAddress: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymAddress {
        return
            try NymAddress(
                nymAddress: FfiConverterString.read(from: &buf), 
                gatewayId: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: NymAddress, into buf: inout [UInt8]) {
        FfiConverterString.write(value.nymAddress, into: &buf)
        FfiConverterString.write(value.gatewayId, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymAddress_lift(_ buf: RustBuffer) throws -> NymAddress {
    return try FfiConverterTypeNymAddress.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymAddress_lower(_ value: NymAddress) -> RustBuffer {
    return FfiConverterTypeNymAddress.lower(value)
}


public struct NymContracts: Equatable, Hashable {
    public var mixnetContractAddress: String?
    public var vestingContractAddress: String?
    public var performanceContractAddress: String?
    public var ecashContractAddress: String?
    public var groupContractAddress: String?
    public var multisigContractAddress: String?
    public var coconutDkgContractAddress: String?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(mixnetContractAddress: String?, vestingContractAddress: String?, performanceContractAddress: String?, ecashContractAddress: String?, groupContractAddress: String?, multisigContractAddress: String?, coconutDkgContractAddress: String?) {
        self.mixnetContractAddress = mixnetContractAddress
        self.vestingContractAddress = vestingContractAddress
        self.performanceContractAddress = performanceContractAddress
        self.ecashContractAddress = ecashContractAddress
        self.groupContractAddress = groupContractAddress
        self.multisigContractAddress = multisigContractAddress
        self.coconutDkgContractAddress = coconutDkgContractAddress
    }

    
}

#if compiler(>=6)
extension NymContracts: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymContracts: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymContracts {
        return
            try NymContracts(
                mixnetContractAddress: FfiConverterOptionString.read(from: &buf), 
                vestingContractAddress: FfiConverterOptionString.read(from: &buf), 
                performanceContractAddress: FfiConverterOptionString.read(from: &buf), 
                ecashContractAddress: FfiConverterOptionString.read(from: &buf), 
                groupContractAddress: FfiConverterOptionString.read(from: &buf), 
                multisigContractAddress: FfiConverterOptionString.read(from: &buf), 
                coconutDkgContractAddress: FfiConverterOptionString.read(from: &buf)
        )
    }

    public static func write(_ value: NymContracts, into buf: inout [UInt8]) {
        FfiConverterOptionString.write(value.mixnetContractAddress, into: &buf)
        FfiConverterOptionString.write(value.vestingContractAddress, into: &buf)
        FfiConverterOptionString.write(value.performanceContractAddress, into: &buf)
        FfiConverterOptionString.write(value.ecashContractAddress, into: &buf)
        FfiConverterOptionString.write(value.groupContractAddress, into: &buf)
        FfiConverterOptionString.write(value.multisigContractAddress, into: &buf)
        FfiConverterOptionString.write(value.coconutDkgContractAddress, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymContracts_lift(_ buf: RustBuffer) throws -> NymContracts {
    return try FfiConverterTypeNymContracts.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymContracts_lower(_ value: NymContracts) -> RustBuffer {
    return FfiConverterTypeNymContracts.lower(value)
}


public struct NymNetworkDetails: Equatable, Hashable {
    public var networkName: String
    public var chainDetails: ChainDetails
    public var endpoints: [ValidatorDetails]
    public var contracts: NymContracts
    public var nymVpnApiUrl: String?
    public var nymApiUrls: [ApiUrl]?
    public var nymVpnApiUrls: [ApiUrl]?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(networkName: String, chainDetails: ChainDetails, endpoints: [ValidatorDetails], contracts: NymContracts, nymVpnApiUrl: String?, nymApiUrls: [ApiUrl]?, nymVpnApiUrls: [ApiUrl]?) {
        self.networkName = networkName
        self.chainDetails = chainDetails
        self.endpoints = endpoints
        self.contracts = contracts
        self.nymVpnApiUrl = nymVpnApiUrl
        self.nymApiUrls = nymApiUrls
        self.nymVpnApiUrls = nymVpnApiUrls
    }

    
}

#if compiler(>=6)
extension NymNetworkDetails: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymNetworkDetails: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymNetworkDetails {
        return
            try NymNetworkDetails(
                networkName: FfiConverterString.read(from: &buf), 
                chainDetails: FfiConverterTypeChainDetails.read(from: &buf), 
                endpoints: FfiConverterSequenceTypeValidatorDetails.read(from: &buf), 
                contracts: FfiConverterTypeNymContracts.read(from: &buf), 
                nymVpnApiUrl: FfiConverterOptionString.read(from: &buf), 
                nymApiUrls: FfiConverterOptionSequenceTypeApiUrl.read(from: &buf), 
                nymVpnApiUrls: FfiConverterOptionSequenceTypeApiUrl.read(from: &buf)
        )
    }

    public static func write(_ value: NymNetworkDetails, into buf: inout [UInt8]) {
        FfiConverterString.write(value.networkName, into: &buf)
        FfiConverterTypeChainDetails.write(value.chainDetails, into: &buf)
        FfiConverterSequenceTypeValidatorDetails.write(value.endpoints, into: &buf)
        FfiConverterTypeNymContracts.write(value.contracts, into: &buf)
        FfiConverterOptionString.write(value.nymVpnApiUrl, into: &buf)
        FfiConverterOptionSequenceTypeApiUrl.write(value.nymApiUrls, into: &buf)
        FfiConverterOptionSequenceTypeApiUrl.write(value.nymVpnApiUrls, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymNetworkDetails_lift(_ buf: RustBuffer) throws -> NymNetworkDetails {
    return try FfiConverterTypeNymNetworkDetails.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymNetworkDetails_lower(_ value: NymNetworkDetails) -> RustBuffer {
    return FfiConverterTypeNymNetworkDetails.lower(value)
}


public struct NymVpnDevice: Equatable, Hashable {
    public var createdOnUtc: String
    public var lastUpdatedUtc: String
    public var deviceIdentityKey: String
    public var status: NymVpnDeviceStatus

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(createdOnUtc: String, lastUpdatedUtc: String, deviceIdentityKey: String, status: NymVpnDeviceStatus) {
        self.createdOnUtc = createdOnUtc
        self.lastUpdatedUtc = lastUpdatedUtc
        self.deviceIdentityKey = deviceIdentityKey
        self.status = status
    }

    
}

#if compiler(>=6)
extension NymVpnDevice: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymVpnDevice: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymVpnDevice {
        return
            try NymVpnDevice(
                createdOnUtc: FfiConverterString.read(from: &buf), 
                lastUpdatedUtc: FfiConverterString.read(from: &buf), 
                deviceIdentityKey: FfiConverterString.read(from: &buf), 
                status: FfiConverterTypeNymVpnDeviceStatus.read(from: &buf)
        )
    }

    public static func write(_ value: NymVpnDevice, into buf: inout [UInt8]) {
        FfiConverterString.write(value.createdOnUtc, into: &buf)
        FfiConverterString.write(value.lastUpdatedUtc, into: &buf)
        FfiConverterString.write(value.deviceIdentityKey, into: &buf)
        FfiConverterTypeNymVpnDeviceStatus.write(value.status, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnDevice_lift(_ buf: RustBuffer) throws -> NymVpnDevice {
    return try FfiConverterTypeNymVpnDevice.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnDevice_lower(_ value: NymVpnDevice) -> RustBuffer {
    return FfiConverterTypeNymVpnDevice.lower(value)
}


public struct NymVpnNetwork: Equatable, Hashable {
    public var nymVpnApiUrls: [ApiUrl]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(nymVpnApiUrls: [ApiUrl]) {
        self.nymVpnApiUrls = nymVpnApiUrls
    }

    
}

#if compiler(>=6)
extension NymVpnNetwork: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymVpnNetwork: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymVpnNetwork {
        return
            try NymVpnNetwork(
                nymVpnApiUrls: FfiConverterSequenceTypeApiUrl.read(from: &buf)
        )
    }

    public static func write(_ value: NymVpnNetwork, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeApiUrl.write(value.nymVpnApiUrls, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnNetwork_lift(_ buf: RustBuffer) throws -> NymVpnNetwork {
    return try FfiConverterTypeNymVpnNetwork.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnNetwork_lower(_ value: NymVpnNetwork) -> RustBuffer {
    return FfiConverterTypeNymVpnNetwork.lower(value)
}


public struct NymVpnUsage: Equatable, Hashable {
    public var createdOnUtc: String
    public var lastUpdatedUtc: String
    public var id: String
    public var subscriptionId: String
    public var validUntilUtc: String
    public var validFromUtc: String
    public var bandwidthAllowanceGb: Double
    public var bandwidthUsedGb: Double

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(createdOnUtc: String, lastUpdatedUtc: String, id: String, subscriptionId: String, validUntilUtc: String, validFromUtc: String, bandwidthAllowanceGb: Double, bandwidthUsedGb: Double) {
        self.createdOnUtc = createdOnUtc
        self.lastUpdatedUtc = lastUpdatedUtc
        self.id = id
        self.subscriptionId = subscriptionId
        self.validUntilUtc = validUntilUtc
        self.validFromUtc = validFromUtc
        self.bandwidthAllowanceGb = bandwidthAllowanceGb
        self.bandwidthUsedGb = bandwidthUsedGb
    }

    
}

#if compiler(>=6)
extension NymVpnUsage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymVpnUsage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymVpnUsage {
        return
            try NymVpnUsage(
                createdOnUtc: FfiConverterString.read(from: &buf), 
                lastUpdatedUtc: FfiConverterString.read(from: &buf), 
                id: FfiConverterString.read(from: &buf), 
                subscriptionId: FfiConverterString.read(from: &buf), 
                validUntilUtc: FfiConverterString.read(from: &buf), 
                validFromUtc: FfiConverterString.read(from: &buf), 
                bandwidthAllowanceGb: FfiConverterDouble.read(from: &buf), 
                bandwidthUsedGb: FfiConverterDouble.read(from: &buf)
        )
    }

    public static func write(_ value: NymVpnUsage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.createdOnUtc, into: &buf)
        FfiConverterString.write(value.lastUpdatedUtc, into: &buf)
        FfiConverterString.write(value.id, into: &buf)
        FfiConverterString.write(value.subscriptionId, into: &buf)
        FfiConverterString.write(value.validUntilUtc, into: &buf)
        FfiConverterString.write(value.validFromUtc, into: &buf)
        FfiConverterDouble.write(value.bandwidthAllowanceGb, into: &buf)
        FfiConverterDouble.write(value.bandwidthUsedGb, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnUsage_lift(_ buf: RustBuffer) throws -> NymVpnUsage {
    return try FfiConverterTypeNymVpnUsage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnUsage_lower(_ value: NymVpnUsage) -> RustBuffer {
    return FfiConverterTypeNymVpnUsage.lower(value)
}


public struct ParsedAccountLinks: Equatable, Hashable {
    public var signUp: String
    public var signIn: String
    public var account: String?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(signUp: String, signIn: String, account: String?) {
        self.signUp = signUp
        self.signIn = signIn
        self.account = account
    }

    
}

#if compiler(>=6)
extension ParsedAccountLinks: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeParsedAccountLinks: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ParsedAccountLinks {
        return
            try ParsedAccountLinks(
                signUp: FfiConverterString.read(from: &buf), 
                signIn: FfiConverterString.read(from: &buf), 
                account: FfiConverterOptionString.read(from: &buf)
        )
    }

    public static func write(_ value: ParsedAccountLinks, into buf: inout [UInt8]) {
        FfiConverterString.write(value.signUp, into: &buf)
        FfiConverterString.write(value.signIn, into: &buf)
        FfiConverterOptionString.write(value.account, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeParsedAccountLinks_lift(_ buf: RustBuffer) throws -> ParsedAccountLinks {
    return try FfiConverterTypeParsedAccountLinks.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeParsedAccountLinks_lower(_ value: ParsedAccountLinks) -> RustBuffer {
    return FfiConverterTypeParsedAccountLinks.lower(value)
}


public struct Performance: Equatable, Hashable {
    public var lastUpdatedUtc: String
    public var score: Score
    public var mixnetScore: Score
    public var load: Score
    public var uptimePercentageLast24Hours: Float

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(lastUpdatedUtc: String, score: Score, mixnetScore: Score, load: Score, uptimePercentageLast24Hours: Float) {
        self.lastUpdatedUtc = lastUpdatedUtc
        self.score = score
        self.mixnetScore = mixnetScore
        self.load = load
        self.uptimePercentageLast24Hours = uptimePercentageLast24Hours
    }

    
}

#if compiler(>=6)
extension Performance: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePerformance: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Performance {
        return
            try Performance(
                lastUpdatedUtc: FfiConverterString.read(from: &buf), 
                score: FfiConverterTypeScore.read(from: &buf), 
                mixnetScore: FfiConverterTypeScore.read(from: &buf), 
                load: FfiConverterTypeScore.read(from: &buf), 
                uptimePercentageLast24Hours: FfiConverterFloat.read(from: &buf)
        )
    }

    public static func write(_ value: Performance, into buf: inout [UInt8]) {
        FfiConverterString.write(value.lastUpdatedUtc, into: &buf)
        FfiConverterTypeScore.write(value.score, into: &buf)
        FfiConverterTypeScore.write(value.mixnetScore, into: &buf)
        FfiConverterTypeScore.write(value.load, into: &buf)
        FfiConverterFloat.write(value.uptimePercentageLast24Hours, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePerformance_lift(_ buf: RustBuffer) throws -> Performance {
    return try FfiConverterTypePerformance.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePerformance_lower(_ value: Performance) -> RustBuffer {
    return FfiConverterTypePerformance.lower(value)
}


public struct PrivyDerivationMessage: Equatable, Hashable {
    public var message: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(message: String) {
        self.message = message
    }

    
}

#if compiler(>=6)
extension PrivyDerivationMessage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePrivyDerivationMessage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrivyDerivationMessage {
        return
            try PrivyDerivationMessage(
                message: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: PrivyDerivationMessage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.message, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePrivyDerivationMessage_lift(_ buf: RustBuffer) throws -> PrivyDerivationMessage {
    return try FfiConverterTypePrivyDerivationMessage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePrivyDerivationMessage_lower(_ value: PrivyDerivationMessage) -> RustBuffer {
    return FfiConverterTypePrivyDerivationMessage.lower(value)
}


public struct Probe: Equatable, Hashable {
    public var lastUpdatedUtc: String
    public var outcome: ProbeOutcome

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(lastUpdatedUtc: String, outcome: ProbeOutcome) {
        self.lastUpdatedUtc = lastUpdatedUtc
        self.outcome = outcome
    }

    
}

#if compiler(>=6)
extension Probe: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeProbe: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Probe {
        return
            try Probe(
                lastUpdatedUtc: FfiConverterString.read(from: &buf), 
                outcome: FfiConverterTypeProbeOutcome.read(from: &buf)
        )
    }

    public static func write(_ value: Probe, into buf: inout [UInt8]) {
        FfiConverterString.write(value.lastUpdatedUtc, into: &buf)
        FfiConverterTypeProbeOutcome.write(value.outcome, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeProbe_lift(_ buf: RustBuffer) throws -> Probe {
    return try FfiConverterTypeProbe.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeProbe_lower(_ value: Probe) -> RustBuffer {
    return FfiConverterTypeProbe.lower(value)
}


public struct ProbeOutcome: Equatable, Hashable {
    public var asEntry: Entry
    public var asExit: Exit?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(asEntry: Entry, asExit: Exit?) {
        self.asEntry = asEntry
        self.asExit = asExit
    }

    
}

#if compiler(>=6)
extension ProbeOutcome: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeProbeOutcome: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ProbeOutcome {
        return
            try ProbeOutcome(
                asEntry: FfiConverterTypeEntry.read(from: &buf), 
                asExit: FfiConverterOptionTypeExit.read(from: &buf)
        )
    }

    public static func write(_ value: ProbeOutcome, into buf: inout [UInt8]) {
        FfiConverterTypeEntry.write(value.asEntry, into: &buf)
        FfiConverterOptionTypeExit.write(value.asExit, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeProbeOutcome_lift(_ buf: RustBuffer) throws -> ProbeOutcome {
    return try FfiConverterTypeProbeOutcome.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeProbeOutcome_lower(_ value: ProbeOutcome) -> RustBuffer {
    return FfiConverterTypeProbeOutcome.lower(value)
}


public struct QuicClientOptions: Equatable, Hashable {
    public var addresses: [SocketAddr]
    public var host: String?
    public var idPubkey: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(addresses: [SocketAddr], host: String?, idPubkey: String) {
        self.addresses = addresses
        self.host = host
        self.idPubkey = idPubkey
    }

    
}

#if compiler(>=6)
extension QuicClientOptions: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeQuicClientOptions: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> QuicClientOptions {
        return
            try QuicClientOptions(
                addresses: FfiConverterSequenceTypeSocketAddr.read(from: &buf), 
                host: FfiConverterOptionString.read(from: &buf), 
                idPubkey: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: QuicClientOptions, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeSocketAddr.write(value.addresses, into: &buf)
        FfiConverterOptionString.write(value.host, into: &buf)
        FfiConverterString.write(value.idPubkey, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeQuicClientOptions_lift(_ buf: RustBuffer) throws -> QuicClientOptions {
    return try FfiConverterTypeQuicClientOptions.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeQuicClientOptions_lower(_ value: QuicClientOptions) -> RustBuffer {
    return FfiConverterTypeQuicClientOptions.lower(value)
}


public struct RegisterAccountResponse: Equatable, Hashable {
    public var accountToken: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(accountToken: String) {
        self.accountToken = accountToken
    }

    
}

#if compiler(>=6)
extension RegisterAccountResponse: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRegisterAccountResponse: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RegisterAccountResponse {
        return
            try RegisterAccountResponse(
                accountToken: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: RegisterAccountResponse, into buf: inout [UInt8]) {
        FfiConverterString.write(value.accountToken, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRegisterAccountResponse_lift(_ buf: RustBuffer) throws -> RegisterAccountResponse {
    return try FfiConverterTypeRegisterAccountResponse.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRegisterAccountResponse_lower(_ value: RegisterAccountResponse) -> RustBuffer {
    return FfiConverterTypeRegisterAccountResponse.lower(value)
}


public struct ScoreThresholds: Equatable, Hashable {
    public var high: UInt8
    public var medium: UInt8
    public var low: UInt8

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(high: UInt8, medium: UInt8, low: UInt8) {
        self.high = high
        self.medium = medium
        self.low = low
    }

    
}

#if compiler(>=6)
extension ScoreThresholds: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeScoreThresholds: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ScoreThresholds {
        return
            try ScoreThresholds(
                high: FfiConverterUInt8.read(from: &buf), 
                medium: FfiConverterUInt8.read(from: &buf), 
                low: FfiConverterUInt8.read(from: &buf)
        )
    }

    public static func write(_ value: ScoreThresholds, into buf: inout [UInt8]) {
        FfiConverterUInt8.write(value.high, into: &buf)
        FfiConverterUInt8.write(value.medium, into: &buf)
        FfiConverterUInt8.write(value.low, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeScoreThresholds_lift(_ buf: RustBuffer) throws -> ScoreThresholds {
    return try FfiConverterTypeScoreThresholds.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeScoreThresholds_lower(_ value: ScoreThresholds) -> RustBuffer {
    return FfiConverterTypeScoreThresholds.lower(value)
}


/**
 * SOCKS5 proxy settings
 */
public struct Socks5Settings: Equatable, Hashable {
    /**
     * SOCKS5 listen address, e.g., 127.0.0.1:1080
     */
    public var listenAddress: SocketAddr?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * SOCKS5 listen address, e.g., 127.0.0.1:1080
         */listenAddress: SocketAddr?) {
        self.listenAddress = listenAddress
    }

    
}

#if compiler(>=6)
extension Socks5Settings: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSocks5Settings: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Socks5Settings {
        return
            try Socks5Settings(
                listenAddress: FfiConverterOptionTypeSocketAddr.read(from: &buf)
        )
    }

    public static func write(_ value: Socks5Settings, into buf: inout [UInt8]) {
        FfiConverterOptionTypeSocketAddr.write(value.listenAddress, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocks5Settings_lift(_ buf: RustBuffer) throws -> Socks5Settings {
    return try FfiConverterTypeSocks5Settings.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocks5Settings_lower(_ value: Socks5Settings) -> RustBuffer {
    return FfiConverterTypeSocks5Settings.lower(value)
}


/**
 * SOCKS5 service status
 */
public struct Socks5Status: Equatable, Hashable {
    /**
     * Current state of the SOCKS5 service
     */
    public var state: Socks5State
    /**
     * SOCKS5 settings
     */
    public var socks5Settings: Socks5Settings
    /**
     * HTTP RPC settings
     */
    public var httpRpcSettings: HttpRpcSettings
    /**
     * Error message (if in error state)
     */
    public var errorMessage: String?
    /**
     * Number of active connections
     */
    public var activeConnections: UInt32

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(
        /**
         * Current state of the SOCKS5 service
         */state: Socks5State, 
        /**
         * SOCKS5 settings
         */socks5Settings: Socks5Settings, 
        /**
         * HTTP RPC settings
         */httpRpcSettings: HttpRpcSettings, 
        /**
         * Error message (if in error state)
         */errorMessage: String?, 
        /**
         * Number of active connections
         */activeConnections: UInt32) {
        self.state = state
        self.socks5Settings = socks5Settings
        self.httpRpcSettings = httpRpcSettings
        self.errorMessage = errorMessage
        self.activeConnections = activeConnections
    }

    
}

#if compiler(>=6)
extension Socks5Status: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSocks5Status: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Socks5Status {
        return
            try Socks5Status(
                state: FfiConverterTypeSocks5State.read(from: &buf), 
                socks5Settings: FfiConverterTypeSocks5Settings.read(from: &buf), 
                httpRpcSettings: FfiConverterTypeHttpRpcSettings.read(from: &buf), 
                errorMessage: FfiConverterOptionString.read(from: &buf), 
                activeConnections: FfiConverterUInt32.read(from: &buf)
        )
    }

    public static func write(_ value: Socks5Status, into buf: inout [UInt8]) {
        FfiConverterTypeSocks5State.write(value.state, into: &buf)
        FfiConverterTypeSocks5Settings.write(value.socks5Settings, into: &buf)
        FfiConverterTypeHttpRpcSettings.write(value.httpRpcSettings, into: &buf)
        FfiConverterOptionString.write(value.errorMessage, into: &buf)
        FfiConverterUInt32.write(value.activeConnections, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocks5Status_lift(_ buf: RustBuffer) throws -> Socks5Status {
    return try FfiConverterTypeSocks5Status.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocks5Status_lower(_ value: Socks5Status) -> RustBuffer {
    return FfiConverterTypeSocks5Status.lower(value)
}


public struct SphinxPacketRates: Equatable, Hashable {
    public var realPacketsSent: Double
    public var realPacketsSentSize: Double
    public var coverPacketsSent: Double
    public var coverPacketsSentSize: Double
    public var realPacketsReceived: Double
    public var realPacketsReceivedSize: Double
    public var coverPacketsReceived: Double
    public var coverPacketsReceivedSize: Double
    public var totalAcksReceived: Double
    public var totalAcksReceivedSize: Double
    public var realAcksReceived: Double
    public var realAcksReceivedSize: Double
    public var coverAcksReceived: Double
    public var coverAcksReceivedSize: Double
    public var realPacketsQueued: Double
    public var retransmissionsQueued: Double
    public var replySurbsQueued: Double
    public var additionalReplySurbsQueued: Double

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(realPacketsSent: Double, realPacketsSentSize: Double, coverPacketsSent: Double, coverPacketsSentSize: Double, realPacketsReceived: Double, realPacketsReceivedSize: Double, coverPacketsReceived: Double, coverPacketsReceivedSize: Double, totalAcksReceived: Double, totalAcksReceivedSize: Double, realAcksReceived: Double, realAcksReceivedSize: Double, coverAcksReceived: Double, coverAcksReceivedSize: Double, realPacketsQueued: Double, retransmissionsQueued: Double, replySurbsQueued: Double, additionalReplySurbsQueued: Double) {
        self.realPacketsSent = realPacketsSent
        self.realPacketsSentSize = realPacketsSentSize
        self.coverPacketsSent = coverPacketsSent
        self.coverPacketsSentSize = coverPacketsSentSize
        self.realPacketsReceived = realPacketsReceived
        self.realPacketsReceivedSize = realPacketsReceivedSize
        self.coverPacketsReceived = coverPacketsReceived
        self.coverPacketsReceivedSize = coverPacketsReceivedSize
        self.totalAcksReceived = totalAcksReceived
        self.totalAcksReceivedSize = totalAcksReceivedSize
        self.realAcksReceived = realAcksReceived
        self.realAcksReceivedSize = realAcksReceivedSize
        self.coverAcksReceived = coverAcksReceived
        self.coverAcksReceivedSize = coverAcksReceivedSize
        self.realPacketsQueued = realPacketsQueued
        self.retransmissionsQueued = retransmissionsQueued
        self.replySurbsQueued = replySurbsQueued
        self.additionalReplySurbsQueued = additionalReplySurbsQueued
    }

    
}

#if compiler(>=6)
extension SphinxPacketRates: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSphinxPacketRates: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SphinxPacketRates {
        return
            try SphinxPacketRates(
                realPacketsSent: FfiConverterDouble.read(from: &buf), 
                realPacketsSentSize: FfiConverterDouble.read(from: &buf), 
                coverPacketsSent: FfiConverterDouble.read(from: &buf), 
                coverPacketsSentSize: FfiConverterDouble.read(from: &buf), 
                realPacketsReceived: FfiConverterDouble.read(from: &buf), 
                realPacketsReceivedSize: FfiConverterDouble.read(from: &buf), 
                coverPacketsReceived: FfiConverterDouble.read(from: &buf), 
                coverPacketsReceivedSize: FfiConverterDouble.read(from: &buf), 
                totalAcksReceived: FfiConverterDouble.read(from: &buf), 
                totalAcksReceivedSize: FfiConverterDouble.read(from: &buf), 
                realAcksReceived: FfiConverterDouble.read(from: &buf), 
                realAcksReceivedSize: FfiConverterDouble.read(from: &buf), 
                coverAcksReceived: FfiConverterDouble.read(from: &buf), 
                coverAcksReceivedSize: FfiConverterDouble.read(from: &buf), 
                realPacketsQueued: FfiConverterDouble.read(from: &buf), 
                retransmissionsQueued: FfiConverterDouble.read(from: &buf), 
                replySurbsQueued: FfiConverterDouble.read(from: &buf), 
                additionalReplySurbsQueued: FfiConverterDouble.read(from: &buf)
        )
    }

    public static func write(_ value: SphinxPacketRates, into buf: inout [UInt8]) {
        FfiConverterDouble.write(value.realPacketsSent, into: &buf)
        FfiConverterDouble.write(value.realPacketsSentSize, into: &buf)
        FfiConverterDouble.write(value.coverPacketsSent, into: &buf)
        FfiConverterDouble.write(value.coverPacketsSentSize, into: &buf)
        FfiConverterDouble.write(value.realPacketsReceived, into: &buf)
        FfiConverterDouble.write(value.realPacketsReceivedSize, into: &buf)
        FfiConverterDouble.write(value.coverPacketsReceived, into: &buf)
        FfiConverterDouble.write(value.coverPacketsReceivedSize, into: &buf)
        FfiConverterDouble.write(value.totalAcksReceived, into: &buf)
        FfiConverterDouble.write(value.totalAcksReceivedSize, into: &buf)
        FfiConverterDouble.write(value.realAcksReceived, into: &buf)
        FfiConverterDouble.write(value.realAcksReceivedSize, into: &buf)
        FfiConverterDouble.write(value.coverAcksReceived, into: &buf)
        FfiConverterDouble.write(value.coverAcksReceivedSize, into: &buf)
        FfiConverterDouble.write(value.realPacketsQueued, into: &buf)
        FfiConverterDouble.write(value.retransmissionsQueued, into: &buf)
        FfiConverterDouble.write(value.replySurbsQueued, into: &buf)
        FfiConverterDouble.write(value.additionalReplySurbsQueued, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSphinxPacketRates_lift(_ buf: RustBuffer) throws -> SphinxPacketRates {
    return try FfiConverterTypeSphinxPacketRates.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSphinxPacketRates_lower(_ value: SphinxPacketRates) -> RustBuffer {
    return FfiConverterTypeSphinxPacketRates.lower(value)
}


public struct SystemConfiguration: Equatable, Hashable {
    public var mixThresholds: ScoreThresholds
    public var wgThresholds: ScoreThresholds
    public var statisticsApi: String?
    public var minSupportedAppVersions: NetworkCompatibility?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(mixThresholds: ScoreThresholds, wgThresholds: ScoreThresholds, statisticsApi: String?, minSupportedAppVersions: NetworkCompatibility?) {
        self.mixThresholds = mixThresholds
        self.wgThresholds = wgThresholds
        self.statisticsApi = statisticsApi
        self.minSupportedAppVersions = minSupportedAppVersions
    }

    
}

#if compiler(>=6)
extension SystemConfiguration: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSystemConfiguration: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SystemConfiguration {
        return
            try SystemConfiguration(
                mixThresholds: FfiConverterTypeScoreThresholds.read(from: &buf), 
                wgThresholds: FfiConverterTypeScoreThresholds.read(from: &buf), 
                statisticsApi: FfiConverterOptionString.read(from: &buf), 
                minSupportedAppVersions: FfiConverterOptionTypeNetworkCompatibility.read(from: &buf)
        )
    }

    public static func write(_ value: SystemConfiguration, into buf: inout [UInt8]) {
        FfiConverterTypeScoreThresholds.write(value.mixThresholds, into: &buf)
        FfiConverterTypeScoreThresholds.write(value.wgThresholds, into: &buf)
        FfiConverterOptionString.write(value.statisticsApi, into: &buf)
        FfiConverterOptionTypeNetworkCompatibility.write(value.minSupportedAppVersions, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSystemConfiguration_lift(_ buf: RustBuffer) throws -> SystemConfiguration {
    return try FfiConverterTypeSystemConfiguration.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSystemConfiguration_lower(_ value: SystemConfiguration) -> RustBuffer {
    return FfiConverterTypeSystemConfiguration.lower(value)
}


public struct SystemMessage: Equatable, Hashable {
    public var name: String
    public var displayFrom: OffsetDateTime?
    public var displayUntil: OffsetDateTime?
    public var message: String
    public var properties: [String: String]?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(name: String, displayFrom: OffsetDateTime?, displayUntil: OffsetDateTime?, message: String, properties: [String: String]?) {
        self.name = name
        self.displayFrom = displayFrom
        self.displayUntil = displayUntil
        self.message = message
        self.properties = properties
    }

    
}

#if compiler(>=6)
extension SystemMessage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSystemMessage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SystemMessage {
        return
            try SystemMessage(
                name: FfiConverterString.read(from: &buf), 
                displayFrom: FfiConverterOptionTypeOffsetDateTime.read(from: &buf), 
                displayUntil: FfiConverterOptionTypeOffsetDateTime.read(from: &buf), 
                message: FfiConverterString.read(from: &buf), 
                properties: FfiConverterOptionDictionaryStringString.read(from: &buf)
        )
    }

    public static func write(_ value: SystemMessage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterOptionTypeOffsetDateTime.write(value.displayFrom, into: &buf)
        FfiConverterOptionTypeOffsetDateTime.write(value.displayUntil, into: &buf)
        FfiConverterString.write(value.message, into: &buf)
        FfiConverterOptionDictionaryStringString.write(value.properties, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSystemMessage_lift(_ buf: RustBuffer) throws -> SystemMessage {
    return try FfiConverterTypeSystemMessage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSystemMessage_lower(_ value: SystemMessage) -> RustBuffer {
    return FfiConverterTypeSystemMessage.lower(value)
}


public struct UserAgent: Equatable, Hashable {
    public var application: String
    public var version: String
    public var platform: String
    public var gitCommit: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(application: String, version: String, platform: String, gitCommit: String) {
        self.application = application
        self.version = version
        self.platform = platform
        self.gitCommit = gitCommit
    }

    
}

#if compiler(>=6)
extension UserAgent: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeUserAgent: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UserAgent {
        return
            try UserAgent(
                application: FfiConverterString.read(from: &buf), 
                version: FfiConverterString.read(from: &buf), 
                platform: FfiConverterString.read(from: &buf), 
                gitCommit: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: UserAgent, into buf: inout [UInt8]) {
        FfiConverterString.write(value.application, into: &buf)
        FfiConverterString.write(value.version, into: &buf)
        FfiConverterString.write(value.platform, into: &buf)
        FfiConverterString.write(value.gitCommit, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeUserAgent_lift(_ buf: RustBuffer) throws -> UserAgent {
    return try FfiConverterTypeUserAgent.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeUserAgent_lower(_ value: UserAgent) -> RustBuffer {
    return FfiConverterTypeUserAgent.lower(value)
}


public struct ValidatorDetails: Equatable, Hashable {
    public var nyxdUrl: String
    public var websocketUrl: String?
    public var apiUrl: String?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(nyxdUrl: String, websocketUrl: String?, apiUrl: String?) {
        self.nyxdUrl = nyxdUrl
        self.websocketUrl = websocketUrl
        self.apiUrl = apiUrl
    }

    
}

#if compiler(>=6)
extension ValidatorDetails: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeValidatorDetails: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ValidatorDetails {
        return
            try ValidatorDetails(
                nyxdUrl: FfiConverterString.read(from: &buf), 
                websocketUrl: FfiConverterOptionString.read(from: &buf), 
                apiUrl: FfiConverterOptionString.read(from: &buf)
        )
    }

    public static func write(_ value: ValidatorDetails, into buf: inout [UInt8]) {
        FfiConverterString.write(value.nyxdUrl, into: &buf)
        FfiConverterOptionString.write(value.websocketUrl, into: &buf)
        FfiConverterOptionString.write(value.apiUrl, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeValidatorDetails_lift(_ buf: RustBuffer) throws -> ValidatorDetails {
    return try FfiConverterTypeValidatorDetails.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeValidatorDetails_lower(_ value: ValidatorDetails) -> RustBuffer {
    return FfiConverterTypeValidatorDetails.lower(value)
}


public struct VpnAccountSummary: Equatable, Hashable {
    public var subscriptionValidUntil: OffsetDateTime?
    public var trafficUsedGb: UInt64
    public var trafficLimitGb: UInt64
    public var trafficResetTime: OffsetDateTime?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(subscriptionValidUntil: OffsetDateTime?, trafficUsedGb: UInt64, trafficLimitGb: UInt64, trafficResetTime: OffsetDateTime?) {
        self.subscriptionValidUntil = subscriptionValidUntil
        self.trafficUsedGb = trafficUsedGb
        self.trafficLimitGb = trafficLimitGb
        self.trafficResetTime = trafficResetTime
    }

    
}

#if compiler(>=6)
extension VpnAccountSummary: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeVpnAccountSummary: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VpnAccountSummary {
        return
            try VpnAccountSummary(
                subscriptionValidUntil: FfiConverterOptionTypeOffsetDateTime.read(from: &buf), 
                trafficUsedGb: FfiConverterUInt64.read(from: &buf), 
                trafficLimitGb: FfiConverterUInt64.read(from: &buf), 
                trafficResetTime: FfiConverterOptionTypeOffsetDateTime.read(from: &buf)
        )
    }

    public static func write(_ value: VpnAccountSummary, into buf: inout [UInt8]) {
        FfiConverterOptionTypeOffsetDateTime.write(value.subscriptionValidUntil, into: &buf)
        FfiConverterUInt64.write(value.trafficUsedGb, into: &buf)
        FfiConverterUInt64.write(value.trafficLimitGb, into: &buf)
        FfiConverterOptionTypeOffsetDateTime.write(value.trafficResetTime, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnAccountSummary_lift(_ buf: RustBuffer) throws -> VpnAccountSummary {
    return try FfiConverterTypeVpnAccountSummary.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnAccountSummary_lower(_ value: VpnAccountSummary) -> RustBuffer {
    return FfiConverterTypeVpnAccountSummary.lower(value)
}


public struct VpnApiErrorResponse: Equatable, Hashable {
    public var message: String
    public var messageId: String?
    public var codeReferenceId: String?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(message: String, messageId: String?, codeReferenceId: String?) {
        self.message = message
        self.messageId = messageId
        self.codeReferenceId = codeReferenceId
    }

    
}

#if compiler(>=6)
extension VpnApiErrorResponse: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeVpnApiErrorResponse: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VpnApiErrorResponse {
        return
            try VpnApiErrorResponse(
                message: FfiConverterString.read(from: &buf), 
                messageId: FfiConverterOptionString.read(from: &buf), 
                codeReferenceId: FfiConverterOptionString.read(from: &buf)
        )
    }

    public static func write(_ value: VpnApiErrorResponse, into buf: inout [UInt8]) {
        FfiConverterString.write(value.message, into: &buf)
        FfiConverterOptionString.write(value.messageId, into: &buf)
        FfiConverterOptionString.write(value.codeReferenceId, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnApiErrorResponse_lift(_ buf: RustBuffer) throws -> VpnApiErrorResponse {
    return try FfiConverterTypeVpnApiErrorResponse.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnApiErrorResponse_lower(_ value: VpnApiErrorResponse) -> RustBuffer {
    return FfiConverterTypeVpnApiErrorResponse.lower(value)
}


public struct VpnServiceConfig: Equatable, Hashable {
    public var entryPoint: EntryPoint
    public var exitPoint: ExitPoint
    public var allowLan: Bool
    public var disableIpv6: Bool
    public var enableTwoHop: Bool
    public var enableBridges: Bool
    public var enableLewesProtocol: Bool
    public var netstack: Bool
    public var minGatewayVpnPerformance: UInt8?
    public var residentialExit: Bool
    public var enableCustomDns: Bool
    public var customDns: [IpAddr]
    public var mixnetTraffic: MixnetTrafficConfig
    public var networkStats: NetworkStatisticsConfig

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(entryPoint: EntryPoint, exitPoint: ExitPoint, allowLan: Bool, disableIpv6: Bool, enableTwoHop: Bool, enableBridges: Bool, enableLewesProtocol: Bool, netstack: Bool, minGatewayVpnPerformance: UInt8?, residentialExit: Bool, enableCustomDns: Bool, customDns: [IpAddr], mixnetTraffic: MixnetTrafficConfig, networkStats: NetworkStatisticsConfig) {
        self.entryPoint = entryPoint
        self.exitPoint = exitPoint
        self.allowLan = allowLan
        self.disableIpv6 = disableIpv6
        self.enableTwoHop = enableTwoHop
        self.enableBridges = enableBridges
        self.enableLewesProtocol = enableLewesProtocol
        self.netstack = netstack
        self.minGatewayVpnPerformance = minGatewayVpnPerformance
        self.residentialExit = residentialExit
        self.enableCustomDns = enableCustomDns
        self.customDns = customDns
        self.mixnetTraffic = mixnetTraffic
        self.networkStats = networkStats
    }

    
}

#if compiler(>=6)
extension VpnServiceConfig: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeVpnServiceConfig: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VpnServiceConfig {
        return
            try VpnServiceConfig(
                entryPoint: FfiConverterTypeEntryPoint.read(from: &buf), 
                exitPoint: FfiConverterTypeExitPoint.read(from: &buf), 
                allowLan: FfiConverterBool.read(from: &buf), 
                disableIpv6: FfiConverterBool.read(from: &buf), 
                enableTwoHop: FfiConverterBool.read(from: &buf), 
                enableBridges: FfiConverterBool.read(from: &buf), 
                enableLewesProtocol: FfiConverterBool.read(from: &buf), 
                netstack: FfiConverterBool.read(from: &buf), 
                minGatewayVpnPerformance: FfiConverterOptionUInt8.read(from: &buf), 
                residentialExit: FfiConverterBool.read(from: &buf), 
                enableCustomDns: FfiConverterBool.read(from: &buf), 
                customDns: FfiConverterSequenceTypeIpAddr.read(from: &buf), 
                mixnetTraffic: FfiConverterTypeMixnetTrafficConfig.read(from: &buf), 
                networkStats: FfiConverterTypeNetworkStatisticsConfig.read(from: &buf)
        )
    }

    public static func write(_ value: VpnServiceConfig, into buf: inout [UInt8]) {
        FfiConverterTypeEntryPoint.write(value.entryPoint, into: &buf)
        FfiConverterTypeExitPoint.write(value.exitPoint, into: &buf)
        FfiConverterBool.write(value.allowLan, into: &buf)
        FfiConverterBool.write(value.disableIpv6, into: &buf)
        FfiConverterBool.write(value.enableTwoHop, into: &buf)
        FfiConverterBool.write(value.enableBridges, into: &buf)
        FfiConverterBool.write(value.enableLewesProtocol, into: &buf)
        FfiConverterBool.write(value.netstack, into: &buf)
        FfiConverterOptionUInt8.write(value.minGatewayVpnPerformance, into: &buf)
        FfiConverterBool.write(value.residentialExit, into: &buf)
        FfiConverterBool.write(value.enableCustomDns, into: &buf)
        FfiConverterSequenceTypeIpAddr.write(value.customDns, into: &buf)
        FfiConverterTypeMixnetTrafficConfig.write(value.mixnetTraffic, into: &buf)
        FfiConverterTypeNetworkStatisticsConfig.write(value.networkStats, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnServiceConfig_lift(_ buf: RustBuffer) throws -> VpnServiceConfig {
    return try FfiConverterTypeVpnServiceConfig.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnServiceConfig_lower(_ value: VpnServiceConfig) -> RustBuffer {
    return FfiConverterTypeVpnServiceConfig.lower(value)
}


public struct VpnServiceInfo: Equatable, Hashable {
    public var version: String
    public var buildTimestamp: OffsetDateTime?
    public var triple: String
    public var platform: String
    public var gitCommit: String
    public var nymNetwork: NymNetworkDetails
    public var nymVpnNetwork: NymVpnNetwork

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(version: String, buildTimestamp: OffsetDateTime?, triple: String, platform: String, gitCommit: String, nymNetwork: NymNetworkDetails, nymVpnNetwork: NymVpnNetwork) {
        self.version = version
        self.buildTimestamp = buildTimestamp
        self.triple = triple
        self.platform = platform
        self.gitCommit = gitCommit
        self.nymNetwork = nymNetwork
        self.nymVpnNetwork = nymVpnNetwork
    }

    
}

#if compiler(>=6)
extension VpnServiceInfo: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeVpnServiceInfo: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VpnServiceInfo {
        return
            try VpnServiceInfo(
                version: FfiConverterString.read(from: &buf), 
                buildTimestamp: FfiConverterOptionTypeOffsetDateTime.read(from: &buf), 
                triple: FfiConverterString.read(from: &buf), 
                platform: FfiConverterString.read(from: &buf), 
                gitCommit: FfiConverterString.read(from: &buf), 
                nymNetwork: FfiConverterTypeNymNetworkDetails.read(from: &buf), 
                nymVpnNetwork: FfiConverterTypeNymVpnNetwork.read(from: &buf)
        )
    }

    public static func write(_ value: VpnServiceInfo, into buf: inout [UInt8]) {
        FfiConverterString.write(value.version, into: &buf)
        FfiConverterOptionTypeOffsetDateTime.write(value.buildTimestamp, into: &buf)
        FfiConverterString.write(value.triple, into: &buf)
        FfiConverterString.write(value.platform, into: &buf)
        FfiConverterString.write(value.gitCommit, into: &buf)
        FfiConverterTypeNymNetworkDetails.write(value.nymNetwork, into: &buf)
        FfiConverterTypeNymVpnNetwork.write(value.nymVpnNetwork, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnServiceInfo_lift(_ buf: RustBuffer) throws -> VpnServiceInfo {
    return try FfiConverterTypeVpnServiceInfo.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnServiceInfo_lower(_ value: VpnServiceInfo) -> RustBuffer {
    return FfiConverterTypeVpnServiceInfo.lower(value)
}


public struct WireguardConnectionData: Equatable, Hashable {
    public var entryBridgeAddr: BridgeAddress?
    public var entry: WireguardNode
    public var exit: WireguardNode

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(entryBridgeAddr: BridgeAddress?, entry: WireguardNode, exit: WireguardNode) {
        self.entryBridgeAddr = entryBridgeAddr
        self.entry = entry
        self.exit = exit
    }

    
}

#if compiler(>=6)
extension WireguardConnectionData: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeWireguardConnectionData: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WireguardConnectionData {
        return
            try WireguardConnectionData(
                entryBridgeAddr: FfiConverterOptionTypeBridgeAddress.read(from: &buf), 
                entry: FfiConverterTypeWireguardNode.read(from: &buf), 
                exit: FfiConverterTypeWireguardNode.read(from: &buf)
        )
    }

    public static func write(_ value: WireguardConnectionData, into buf: inout [UInt8]) {
        FfiConverterOptionTypeBridgeAddress.write(value.entryBridgeAddr, into: &buf)
        FfiConverterTypeWireguardNode.write(value.entry, into: &buf)
        FfiConverterTypeWireguardNode.write(value.exit, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWireguardConnectionData_lift(_ buf: RustBuffer) throws -> WireguardConnectionData {
    return try FfiConverterTypeWireguardConnectionData.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWireguardConnectionData_lower(_ value: WireguardConnectionData) -> RustBuffer {
    return FfiConverterTypeWireguardConnectionData.lower(value)
}


public struct WireguardNode: Equatable, Hashable {
    public var endpoint: SocketAddr
    public var publicKey: String
    public var privateIpv4: Ipv4Addr
    public var privateIpv6: Ipv6Addr?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(endpoint: SocketAddr, publicKey: String, privateIpv4: Ipv4Addr, privateIpv6: Ipv6Addr?) {
        self.endpoint = endpoint
        self.publicKey = publicKey
        self.privateIpv4 = privateIpv4
        self.privateIpv6 = privateIpv6
    }

    
}

#if compiler(>=6)
extension WireguardNode: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeWireguardNode: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WireguardNode {
        return
            try WireguardNode(
                endpoint: FfiConverterTypeSocketAddr.read(from: &buf), 
                publicKey: FfiConverterString.read(from: &buf), 
                privateIpv4: FfiConverterTypeIpv4Addr.read(from: &buf), 
                privateIpv6: FfiConverterOptionTypeIpv6Addr.read(from: &buf)
        )
    }

    public static func write(_ value: WireguardNode, into buf: inout [UInt8]) {
        FfiConverterTypeSocketAddr.write(value.endpoint, into: &buf)
        FfiConverterString.write(value.publicKey, into: &buf)
        FfiConverterTypeIpv4Addr.write(value.privateIpv4, into: &buf)
        FfiConverterOptionTypeIpv6Addr.write(value.privateIpv6, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWireguardNode_lift(_ buf: RustBuffer) throws -> WireguardNode {
    return try FfiConverterTypeWireguardNode.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWireguardNode_lower(_ value: WireguardNode) -> RustBuffer {
    return FfiConverterTypeWireguardNode.lower(value)
}


public enum AccountCommandError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {

    
    
    case Internal(String
    )
    case Storage(String
    )
    case VpnApi(VpnApiError
    )
    case UnexpectedVpnApiResponse(String
    )
    case NyxdConnectionFailure(String
    )
    case NyxdQueryFailure(String
    )
    case AccountDoesntExistOnChain
    case NoAccountStored
    case NoDeviceStored
    case ExistingAccount
    case Offline
    case AccountNotDecentralised
    case AccountDecentralised
    case InsufficientFunds
    case ZkNymAcquisitionFailure(String
    )
    case InvalidMnemonic(String
    )
    case InvalidSecret(String
    )
    case DeeplinkError(String
    )

    

    
    public var errorDescription: String? {
        String(reflecting: self)
    }
    
}

#if compiler(>=6)
extension AccountCommandError: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAccountCommandError: FfiConverterRustBuffer {
    typealias SwiftType = AccountCommandError

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountCommandError {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        

        
        case 1: return .Internal(
            try FfiConverterString.read(from: &buf)
            )
        case 2: return .Storage(
            try FfiConverterString.read(from: &buf)
            )
        case 3: return .VpnApi(
            try FfiConverterTypeVpnApiError.read(from: &buf)
            )
        case 4: return .UnexpectedVpnApiResponse(
            try FfiConverterString.read(from: &buf)
            )
        case 5: return .NyxdConnectionFailure(
            try FfiConverterString.read(from: &buf)
            )
        case 6: return .NyxdQueryFailure(
            try FfiConverterString.read(from: &buf)
            )
        case 7: return .AccountDoesntExistOnChain
        case 8: return .NoAccountStored
        case 9: return .NoDeviceStored
        case 10: return .ExistingAccount
        case 11: return .Offline
        case 12: return .AccountNotDecentralised
        case 13: return .AccountDecentralised
        case 14: return .InsufficientFunds
        case 15: return .ZkNymAcquisitionFailure(
            try FfiConverterString.read(from: &buf)
            )
        case 16: return .InvalidMnemonic(
            try FfiConverterString.read(from: &buf)
            )
        case 17: return .InvalidSecret(
            try FfiConverterString.read(from: &buf)
            )
        case 18: return .DeeplinkError(
            try FfiConverterString.read(from: &buf)
            )

         default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: AccountCommandError, into buf: inout [UInt8]) {
        switch value {

        

        
        
        case let .Internal(v1):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .Storage(v1):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .VpnApi(v1):
            writeInt(&buf, Int32(3))
            FfiConverterTypeVpnApiError.write(v1, into: &buf)
            
        
        case let .UnexpectedVpnApiResponse(v1):
            writeInt(&buf, Int32(4))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .NyxdConnectionFailure(v1):
            writeInt(&buf, Int32(5))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .NyxdQueryFailure(v1):
            writeInt(&buf, Int32(6))
            FfiConverterString.write(v1, into: &buf)
            
        
        case .AccountDoesntExistOnChain:
            writeInt(&buf, Int32(7))
        
        
        case .NoAccountStored:
            writeInt(&buf, Int32(8))
        
        
        case .NoDeviceStored:
            writeInt(&buf, Int32(9))
        
        
        case .ExistingAccount:
            writeInt(&buf, Int32(10))
        
        
        case .Offline:
            writeInt(&buf, Int32(11))
        
        
        case .AccountNotDecentralised:
            writeInt(&buf, Int32(12))
        
        
        case .AccountDecentralised:
            writeInt(&buf, Int32(13))
        
        
        case .InsufficientFunds:
            writeInt(&buf, Int32(14))
        
        
        case let .ZkNymAcquisitionFailure(v1):
            writeInt(&buf, Int32(15))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .InvalidMnemonic(v1):
            writeInt(&buf, Int32(16))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .InvalidSecret(v1):
            writeInt(&buf, Int32(17))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .DeeplinkError(v1):
            writeInt(&buf, Int32(18))
            FfiConverterString.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountCommandError_lift(_ buf: RustBuffer) throws -> AccountCommandError {
    return try FfiConverterTypeAccountCommandError.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountCommandError_lower(_ value: AccountCommandError) -> RustBuffer {
    return FfiConverterTypeAccountCommandError.lower(value)
}


public enum AccountControllerError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {

    
    
    case Offline
    case NoAccountStored
    case Internal(String
    )
    case ErrorState(AccountControllerErrorStateReason
    )

    

    
    public var errorDescription: String? {
        String(reflecting: self)
    }
    
}

#if compiler(>=6)
extension AccountControllerError: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAccountControllerError: FfiConverterRustBuffer {
    typealias SwiftType = AccountControllerError

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountControllerError {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        

        
        case 1: return .Offline
        case 2: return .NoAccountStored
        case 3: return .Internal(
            try FfiConverterString.read(from: &buf)
            )
        case 4: return .ErrorState(
            try FfiConverterTypeAccountControllerErrorStateReason.read(from: &buf)
            )

         default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: AccountControllerError, into buf: inout [UInt8]) {
        switch value {

        

        
        
        case .Offline:
            writeInt(&buf, Int32(1))
        
        
        case .NoAccountStored:
            writeInt(&buf, Int32(2))
        
        
        case let .Internal(v1):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .ErrorState(v1):
            writeInt(&buf, Int32(4))
            FfiConverterTypeAccountControllerErrorStateReason.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountControllerError_lift(_ buf: RustBuffer) throws -> AccountControllerError {
    return try FfiConverterTypeAccountControllerError.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountControllerError_lower(_ value: AccountControllerError) -> RustBuffer {
    return FfiConverterTypeAccountControllerError.lower(value)
}

// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum AccountControllerErrorStateReason: Equatable, Hashable {
    
    /**
     * Error due to storage
     */
    case storage(context: String, details: String
    )
    /**
     * API Failure
     */
    case apiFailure(context: String, details: String
    )
    /**
     * Internal
     */
    case `internal`(context: String, details: String
    )
    /**
     * Bandwidth Exceeded
     */
    case bandwidthExceeded(context: String
    )
    /**
     * Account status is not "Active"
     */
    case accountStatusNotActive(status: String
    )
    /**
     * Inactive Subscription
     */
    case inactiveSubscription
    /**
     * Max device numbers reached
     */
    case maxDeviceReached
    /**
     * Device time is off by too much, Zk-nyms use will fail
     */
    case deviceTimeDesynced



}

#if compiler(>=6)
extension AccountControllerErrorStateReason: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAccountControllerErrorStateReason: FfiConverterRustBuffer {
    typealias SwiftType = AccountControllerErrorStateReason

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountControllerErrorStateReason {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .storage(context: try FfiConverterString.read(from: &buf), details: try FfiConverterString.read(from: &buf)
        )
        
        case 2: return .apiFailure(context: try FfiConverterString.read(from: &buf), details: try FfiConverterString.read(from: &buf)
        )
        
        case 3: return .`internal`(context: try FfiConverterString.read(from: &buf), details: try FfiConverterString.read(from: &buf)
        )
        
        case 4: return .bandwidthExceeded(context: try FfiConverterString.read(from: &buf)
        )
        
        case 5: return .accountStatusNotActive(status: try FfiConverterString.read(from: &buf)
        )
        
        case 6: return .inactiveSubscription
        
        case 7: return .maxDeviceReached
        
        case 8: return .deviceTimeDesynced
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: AccountControllerErrorStateReason, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .storage(context,details):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(context, into: &buf)
            FfiConverterString.write(details, into: &buf)
            
        
        case let .apiFailure(context,details):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(context, into: &buf)
            FfiConverterString.write(details, into: &buf)
            
        
        case let .`internal`(context,details):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(context, into: &buf)
            FfiConverterString.write(details, into: &buf)
            
        
        case let .bandwidthExceeded(context):
            writeInt(&buf, Int32(4))
            FfiConverterString.write(context, into: &buf)
            
        
        case let .accountStatusNotActive(status):
            writeInt(&buf, Int32(5))
            FfiConverterString.write(status, into: &buf)
            
        
        case .inactiveSubscription:
            writeInt(&buf, Int32(6))
        
        
        case .maxDeviceReached:
            writeInt(&buf, Int32(7))
        
        
        case .deviceTimeDesynced:
            writeInt(&buf, Int32(8))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountControllerErrorStateReason_lift(_ buf: RustBuffer) throws -> AccountControllerErrorStateReason {
    return try FfiConverterTypeAccountControllerErrorStateReason.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountControllerErrorStateReason_lower(_ value: AccountControllerErrorStateReason) -> RustBuffer {
    return FfiConverterTypeAccountControllerErrorStateReason.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum AccountControllerState: Equatable, Hashable {
    
    /**
     * We don't have network
     */
    case offline
    /**
     * Figuring out account state
     */
    case syncing
    /**
     * Not logged in with a mnemonic
     */
    case loggedOut
    /**
     * Logged in, registered device, zk-nyms not available
     */
    case requestingZkNyms
    /**
     * Logged in, registered device, available zk-nyms
     */
    case readyToConnect
    /**
     * Logged in, operating independently of VPN API
     */
    case decentralised
    /**
     * Network is undergoing an upgrade, can't get zk-nyms, but got an alternative credential.
     */
    case upgradeMode
    /**
     * Logged in, error during sync, can't proceed
     */
    case error(AccountControllerErrorStateReason
    )



}

#if compiler(>=6)
extension AccountControllerState: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAccountControllerState: FfiConverterRustBuffer {
    typealias SwiftType = AccountControllerState

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountControllerState {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .offline
        
        case 2: return .syncing
        
        case 3: return .loggedOut
        
        case 4: return .requestingZkNyms
        
        case 5: return .readyToConnect
        
        case 6: return .decentralised
        
        case 7: return .upgradeMode
        
        case 8: return .error(try FfiConverterTypeAccountControllerErrorStateReason.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: AccountControllerState, into buf: inout [UInt8]) {
        switch value {
        
        
        case .offline:
            writeInt(&buf, Int32(1))
        
        
        case .syncing:
            writeInt(&buf, Int32(2))
        
        
        case .loggedOut:
            writeInt(&buf, Int32(3))
        
        
        case .requestingZkNyms:
            writeInt(&buf, Int32(4))
        
        
        case .readyToConnect:
            writeInt(&buf, Int32(5))
        
        
        case .decentralised:
            writeInt(&buf, Int32(6))
        
        
        case .upgradeMode:
            writeInt(&buf, Int32(7))
        
        
        case let .error(v1):
            writeInt(&buf, Int32(8))
            FfiConverterTypeAccountControllerErrorStateReason.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountControllerState_lift(_ buf: RustBuffer) throws -> AccountControllerState {
    return try FfiConverterTypeAccountControllerState.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAccountControllerState_lower(_ value: AccountControllerState) -> RustBuffer {
    return FfiConverterTypeAccountControllerState.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
/**
 * Public enum describing action to perform after disconnect
 */

public enum ActionAfterDisconnect: Equatable, Hashable {
    
    /**
     * Do nothing after disconnect
     */
    case nothing
    /**
     * Reconnect after disconnect
     */
    case reconnect
    /**
     * Enter offline after disconnect
     */
    case offline
    /**
     * Enter error state
     */
    case error



}

#if compiler(>=6)
extension ActionAfterDisconnect: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeActionAfterDisconnect: FfiConverterRustBuffer {
    typealias SwiftType = ActionAfterDisconnect

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ActionAfterDisconnect {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .nothing
        
        case 2: return .reconnect
        
        case 3: return .offline
        
        case 4: return .error
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ActionAfterDisconnect, into buf: inout [UInt8]) {
        switch value {
        
        
        case .nothing:
            writeInt(&buf, Int32(1))
        
        
        case .reconnect:
            writeInt(&buf, Int32(2))
        
        
        case .offline:
            writeInt(&buf, Int32(3))
        
        
        case .error:
            writeInt(&buf, Int32(4))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActionAfterDisconnect_lift(_ buf: RustBuffer) throws -> ActionAfterDisconnect {
    return try FfiConverterTypeActionAfterDisconnect.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActionAfterDisconnect_lower(_ value: ActionAfterDisconnect) -> RustBuffer {
    return FfiConverterTypeActionAfterDisconnect.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum AsnKind: Equatable, Hashable {
    
    case residential
    case other



}

#if compiler(>=6)
extension AsnKind: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeAsnKind: FfiConverterRustBuffer {
    typealias SwiftType = AsnKind

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AsnKind {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .residential
        
        case 2: return .other
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: AsnKind, into buf: inout [UInt8]) {
        switch value {
        
        
        case .residential:
            writeInt(&buf, Int32(1))
        
        
        case .other:
            writeInt(&buf, Int32(2))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAsnKind_lift(_ buf: RustBuffer) throws -> AsnKind {
    return try FfiConverterTypeAsnKind.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeAsnKind_lower(_ value: AsnKind) -> RustBuffer {
    return FfiConverterTypeAsnKind.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum BandwidthEvent: Equatable, Hashable {
    
    case noBandwidth
    case remainingBandwidth(Int64
    )



}

#if compiler(>=6)
extension BandwidthEvent: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBandwidthEvent: FfiConverterRustBuffer {
    typealias SwiftType = BandwidthEvent

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BandwidthEvent {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .noBandwidth
        
        case 2: return .remainingBandwidth(try FfiConverterInt64.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: BandwidthEvent, into buf: inout [UInt8]) {
        switch value {
        
        
        case .noBandwidth:
            writeInt(&buf, Int32(1))
        
        
        case let .remainingBandwidth(v1):
            writeInt(&buf, Int32(2))
            FfiConverterInt64.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBandwidthEvent_lift(_ buf: RustBuffer) throws -> BandwidthEvent {
    return try FfiConverterTypeBandwidthEvent.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBandwidthEvent_lower(_ value: BandwidthEvent) -> RustBuffer {
    return FfiConverterTypeBandwidthEvent.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum BridgeParameters: Equatable, Hashable {
    
    case quicPlain(QuicClientOptions
    )



}

#if compiler(>=6)
extension BridgeParameters: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBridgeParameters: FfiConverterRustBuffer {
    typealias SwiftType = BridgeParameters

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BridgeParameters {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .quicPlain(try FfiConverterTypeQuicClientOptions.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: BridgeParameters, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .quicPlain(v1):
            writeInt(&buf, Int32(1))
            FfiConverterTypeQuicClientOptions.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBridgeParameters_lift(_ buf: RustBuffer) throws -> BridgeParameters {
    return try FfiConverterTypeBridgeParameters.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBridgeParameters_lower(_ value: BridgeParameters) -> RustBuffer {
    return FfiConverterTypeBridgeParameters.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum ConnectionEvent: Equatable, Hashable {
    
    case entryGatewayDown
    case exitGatewayDownIpv4
    case exitGatewayDownIpv6
    case exitGatewayRoutingErrorIpv4
    case exitGatewayRoutingErrorIpv6
    case connectedIpv4
    case connectedIpv6



}

#if compiler(>=6)
extension ConnectionEvent: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeConnectionEvent: FfiConverterRustBuffer {
    typealias SwiftType = ConnectionEvent

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ConnectionEvent {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .entryGatewayDown
        
        case 2: return .exitGatewayDownIpv4
        
        case 3: return .exitGatewayDownIpv6
        
        case 4: return .exitGatewayRoutingErrorIpv4
        
        case 5: return .exitGatewayRoutingErrorIpv6
        
        case 6: return .connectedIpv4
        
        case 7: return .connectedIpv6
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ConnectionEvent, into buf: inout [UInt8]) {
        switch value {
        
        
        case .entryGatewayDown:
            writeInt(&buf, Int32(1))
        
        
        case .exitGatewayDownIpv4:
            writeInt(&buf, Int32(2))
        
        
        case .exitGatewayDownIpv6:
            writeInt(&buf, Int32(3))
        
        
        case .exitGatewayRoutingErrorIpv4:
            writeInt(&buf, Int32(4))
        
        
        case .exitGatewayRoutingErrorIpv6:
            writeInt(&buf, Int32(5))
        
        
        case .connectedIpv4:
            writeInt(&buf, Int32(6))
        
        
        case .connectedIpv6:
            writeInt(&buf, Int32(7))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeConnectionEvent_lift(_ buf: RustBuffer) throws -> ConnectionEvent {
    return try FfiConverterTypeConnectionEvent.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeConnectionEvent_lower(_ value: ConnectionEvent) -> RustBuffer {
    return FfiConverterTypeConnectionEvent.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum DeeplinkClient: Equatable, Hashable {
    
    case mobile
    case desktop
    case web



}

#if compiler(>=6)
extension DeeplinkClient: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDeeplinkClient: FfiConverterRustBuffer {
    typealias SwiftType = DeeplinkClient

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DeeplinkClient {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .mobile
        
        case 2: return .desktop
        
        case 3: return .web
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: DeeplinkClient, into buf: inout [UInt8]) {
        switch value {
        
        
        case .mobile:
            writeInt(&buf, Int32(1))
        
        
        case .desktop:
            writeInt(&buf, Int32(2))
        
        
        case .web:
            writeInt(&buf, Int32(3))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDeeplinkClient_lift(_ buf: RustBuffer) throws -> DeeplinkClient {
    return try FfiConverterTypeDeeplinkClient.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDeeplinkClient_lower(_ value: DeeplinkClient) -> RustBuffer {
    return FfiConverterTypeDeeplinkClient.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum DeeplinkKind: Equatable, Hashable {
    
    case privy



}

#if compiler(>=6)
extension DeeplinkKind: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDeeplinkKind: FfiConverterRustBuffer {
    typealias SwiftType = DeeplinkKind

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DeeplinkKind {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .privy
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: DeeplinkKind, into buf: inout [UInt8]) {
        switch value {
        
        
        case .privy:
            writeInt(&buf, Int32(1))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDeeplinkKind_lift(_ buf: RustBuffer) throws -> DeeplinkKind {
    return try FfiConverterTypeDeeplinkKind.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDeeplinkKind_lower(_ value: DeeplinkKind) -> RustBuffer {
    return FfiConverterTypeDeeplinkKind.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum EntryPoint: Equatable, Hashable {
    
    case gateway(identity: NodeIdentity
    )
    case country(twoLetterIsoCountryCode: String
    )
    case region(region: String
    )
    case random



}

#if compiler(>=6)
extension EntryPoint: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeEntryPoint: FfiConverterRustBuffer {
    typealias SwiftType = EntryPoint

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EntryPoint {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .gateway(identity: try FfiConverterTypeNodeIdentity.read(from: &buf)
        )
        
        case 2: return .country(twoLetterIsoCountryCode: try FfiConverterString.read(from: &buf)
        )
        
        case 3: return .region(region: try FfiConverterString.read(from: &buf)
        )
        
        case 4: return .random
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: EntryPoint, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .gateway(identity):
            writeInt(&buf, Int32(1))
            FfiConverterTypeNodeIdentity.write(identity, into: &buf)
            
        
        case let .country(twoLetterIsoCountryCode):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(twoLetterIsoCountryCode, into: &buf)
            
        
        case let .region(region):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(region, into: &buf)
            
        
        case .random:
            writeInt(&buf, Int32(4))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEntryPoint_lift(_ buf: RustBuffer) throws -> EntryPoint {
    return try FfiConverterTypeEntryPoint.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEntryPoint_lower(_ value: EntryPoint) -> RustBuffer {
    return FfiConverterTypeEntryPoint.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum ErrorStateReason: Equatable, Hashable {
    
    /**
     * Failure to set firewall policy.
     */
    case setFirewallPolicy
    /**
     * Failure to configure routing.
     */
    case setRouting
    /**
     * Failure to configure dns.
     */
    case setDns
    /**
     * Failure to configure tunnel device.
     */
    case tunDevice
    /**
     * Failure to configure packet tunnel provider (iOS and Android only)
     */
    case tunnelProvider
    /**
     * IPv6 is disabled in the system.
     */
    case ipv6Unavailable
    /**
     * Same entry and exit gateway are unsupported.
     */
    case sameEntryAndExitGateway
    /**
     * Failure to select any entry gateway after trying all performance tiers.
     */
    case performantEntryGatewayUnavailable
    /**
     * Failure to select any exit gateway after trying all performance tiers.
     */
    case performantExitGatewayUnavailable
    /**
     * Invalid identity set for entry gateway
     */
    case invalidEntryGatewayIdentity
    /**
     * Invalid identity set for exit gateway
     */
    case invalidExitGatewayIdentity
    /**
     * Invalid country set for entry gateway
     */
    case invalidEntryGatewayCountry
    /**
     * Invalid country set for exit gateway
     */
    case invalidExitGatewayCountry
    /**
     * Entry gateway is not responding or responding badly to a bandwidth
     * increase request, causing credential waste
     */
    case credentialWastedOnEntryGateway
    /**
     * Exit gateway is not responding or responding badly to a bandwidth
     * increase request, causing credential waste
     */
    case credentialWastedOnExitGateway
    /**
     * Bandwidth Exceeded
     */
    case bandwidthExceeded
    /**
     * Account status is not "Active"
     */
    case inactiveAccount
    /**
     * Inactive Subscription
     */
    case inactiveSubscription
    /**
     * Max device numbers reached
     */
    case maxDevicesReached
    /**
     * Device time is off by too much, Zk-nyms use will fail
     */
    case deviceTimeOutOfSync
    /**
     * Device is logged out
     */
    case deviceLoggedOut
    /**
     * Program errors that must not happen.
     */
    case `internal`(String
    )



}

#if compiler(>=6)
extension ErrorStateReason: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeErrorStateReason: FfiConverterRustBuffer {
    typealias SwiftType = ErrorStateReason

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ErrorStateReason {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .setFirewallPolicy
        
        case 2: return .setRouting
        
        case 3: return .setDns
        
        case 4: return .tunDevice
        
        case 5: return .tunnelProvider
        
        case 6: return .ipv6Unavailable
        
        case 7: return .sameEntryAndExitGateway
        
        case 8: return .performantEntryGatewayUnavailable
        
        case 9: return .performantExitGatewayUnavailable
        
        case 10: return .invalidEntryGatewayIdentity
        
        case 11: return .invalidExitGatewayIdentity
        
        case 12: return .invalidEntryGatewayCountry
        
        case 13: return .invalidExitGatewayCountry
        
        case 14: return .credentialWastedOnEntryGateway
        
        case 15: return .credentialWastedOnExitGateway
        
        case 16: return .bandwidthExceeded
        
        case 17: return .inactiveAccount
        
        case 18: return .inactiveSubscription
        
        case 19: return .maxDevicesReached
        
        case 20: return .deviceTimeOutOfSync
        
        case 21: return .deviceLoggedOut
        
        case 22: return .`internal`(try FfiConverterString.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ErrorStateReason, into buf: inout [UInt8]) {
        switch value {
        
        
        case .setFirewallPolicy:
            writeInt(&buf, Int32(1))
        
        
        case .setRouting:
            writeInt(&buf, Int32(2))
        
        
        case .setDns:
            writeInt(&buf, Int32(3))
        
        
        case .tunDevice:
            writeInt(&buf, Int32(4))
        
        
        case .tunnelProvider:
            writeInt(&buf, Int32(5))
        
        
        case .ipv6Unavailable:
            writeInt(&buf, Int32(6))
        
        
        case .sameEntryAndExitGateway:
            writeInt(&buf, Int32(7))
        
        
        case .performantEntryGatewayUnavailable:
            writeInt(&buf, Int32(8))
        
        
        case .performantExitGatewayUnavailable:
            writeInt(&buf, Int32(9))
        
        
        case .invalidEntryGatewayIdentity:
            writeInt(&buf, Int32(10))
        
        
        case .invalidExitGatewayIdentity:
            writeInt(&buf, Int32(11))
        
        
        case .invalidEntryGatewayCountry:
            writeInt(&buf, Int32(12))
        
        
        case .invalidExitGatewayCountry:
            writeInt(&buf, Int32(13))
        
        
        case .credentialWastedOnEntryGateway:
            writeInt(&buf, Int32(14))
        
        
        case .credentialWastedOnExitGateway:
            writeInt(&buf, Int32(15))
        
        
        case .bandwidthExceeded:
            writeInt(&buf, Int32(16))
        
        
        case .inactiveAccount:
            writeInt(&buf, Int32(17))
        
        
        case .inactiveSubscription:
            writeInt(&buf, Int32(18))
        
        
        case .maxDevicesReached:
            writeInt(&buf, Int32(19))
        
        
        case .deviceTimeOutOfSync:
            writeInt(&buf, Int32(20))
        
        
        case .deviceLoggedOut:
            writeInt(&buf, Int32(21))
        
        
        case let .`internal`(v1):
            writeInt(&buf, Int32(22))
            FfiConverterString.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeErrorStateReason_lift(_ buf: RustBuffer) throws -> ErrorStateReason {
    return try FfiConverterTypeErrorStateReason.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeErrorStateReason_lower(_ value: ErrorStateReason) -> RustBuffer {
    return FfiConverterTypeErrorStateReason.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
/**
 * Describes the current state when establishing connection.
 */

public enum EstablishConnectionState: Equatable, Hashable {
    
    /**
     * Resolving API IP addresses
     */
    case resolvingApiAddresses
    /**
     * Awaiting for account to be ready for establishing connection
     */
    case awaitingAccountReadiness
    /**
     * Refreshing gateways
     */
    case refreshingGateways
    /**
     * Selecting gateways
     */
    case selectingGateways
    /**
     * Registering with gateways
     */
    case registeringWithGateways
    /**
     * Establishing tunnel connection
     */
    case connectingTunnel



}

#if compiler(>=6)
extension EstablishConnectionState: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeEstablishConnectionState: FfiConverterRustBuffer {
    typealias SwiftType = EstablishConnectionState

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EstablishConnectionState {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .resolvingApiAddresses
        
        case 2: return .awaitingAccountReadiness
        
        case 3: return .refreshingGateways
        
        case 4: return .selectingGateways
        
        case 5: return .registeringWithGateways
        
        case 6: return .connectingTunnel
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: EstablishConnectionState, into buf: inout [UInt8]) {
        switch value {
        
        
        case .resolvingApiAddresses:
            writeInt(&buf, Int32(1))
        
        
        case .awaitingAccountReadiness:
            writeInt(&buf, Int32(2))
        
        
        case .refreshingGateways:
            writeInt(&buf, Int32(3))
        
        
        case .selectingGateways:
            writeInt(&buf, Int32(4))
        
        
        case .registeringWithGateways:
            writeInt(&buf, Int32(5))
        
        
        case .connectingTunnel:
            writeInt(&buf, Int32(6))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEstablishConnectionState_lift(_ buf: RustBuffer) throws -> EstablishConnectionState {
    return try FfiConverterTypeEstablishConnectionState.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeEstablishConnectionState_lower(_ value: EstablishConnectionState) -> RustBuffer {
    return FfiConverterTypeEstablishConnectionState.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum ExitPoint: Equatable, Hashable {
    
    case address(address: BoxedRecepient
    )
    case gateway(identity: NodeIdentity
    )
    case country(twoLetterIsoCountryCode: String
    )
    case region(region: String
    )
    case random



}

#if compiler(>=6)
extension ExitPoint: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeExitPoint: FfiConverterRustBuffer {
    typealias SwiftType = ExitPoint

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ExitPoint {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .address(address: try FfiConverterTypeBoxedRecepient.read(from: &buf)
        )
        
        case 2: return .gateway(identity: try FfiConverterTypeNodeIdentity.read(from: &buf)
        )
        
        case 3: return .country(twoLetterIsoCountryCode: try FfiConverterString.read(from: &buf)
        )
        
        case 4: return .region(region: try FfiConverterString.read(from: &buf)
        )
        
        case 5: return .random
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ExitPoint, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .address(address):
            writeInt(&buf, Int32(1))
            FfiConverterTypeBoxedRecepient.write(address, into: &buf)
            
        
        case let .gateway(identity):
            writeInt(&buf, Int32(2))
            FfiConverterTypeNodeIdentity.write(identity, into: &buf)
            
        
        case let .country(twoLetterIsoCountryCode):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(twoLetterIsoCountryCode, into: &buf)
            
        
        case let .region(region):
            writeInt(&buf, Int32(4))
            FfiConverterString.write(region, into: &buf)
            
        
        case .random:
            writeInt(&buf, Int32(5))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeExitPoint_lift(_ buf: RustBuffer) throws -> ExitPoint {
    return try FfiConverterTypeExitPoint.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeExitPoint_lower(_ value: ExitPoint) -> RustBuffer {
    return FfiConverterTypeExitPoint.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum FlagValue: Equatable, Hashable {
    
    case value(String
    )
    case group([String: String]
    )



}

#if compiler(>=6)
extension FlagValue: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeFlagValue: FfiConverterRustBuffer {
    typealias SwiftType = FlagValue

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FlagValue {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .value(try FfiConverterString.read(from: &buf)
        )
        
        case 2: return .group(try FfiConverterDictionaryStringString.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: FlagValue, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .value(v1):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .group(v1):
            writeInt(&buf, Int32(2))
            FfiConverterDictionaryStringString.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFlagValue_lift(_ buf: RustBuffer) throws -> FlagValue {
    return try FfiConverterTypeFlagValue.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFlagValue_lower(_ value: FlagValue) -> RustBuffer {
    return FfiConverterTypeFlagValue.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum GatewayFilter: Equatable, Hashable {
    
    case minScore(Score
    )
    case country(String
    )
    case region(String
    )
    case residential
    case quicEnabled
    case exit
    case vpn



}

#if compiler(>=6)
extension GatewayFilter: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGatewayFilter: FfiConverterRustBuffer {
    typealias SwiftType = GatewayFilter

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GatewayFilter {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .minScore(try FfiConverterTypeScore.read(from: &buf)
        )
        
        case 2: return .country(try FfiConverterString.read(from: &buf)
        )
        
        case 3: return .region(try FfiConverterString.read(from: &buf)
        )
        
        case 4: return .residential
        
        case 5: return .quicEnabled
        
        case 6: return .exit
        
        case 7: return .vpn
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: GatewayFilter, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .minScore(v1):
            writeInt(&buf, Int32(1))
            FfiConverterTypeScore.write(v1, into: &buf)
            
        
        case let .country(v1):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .region(v1):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(v1, into: &buf)
            
        
        case .residential:
            writeInt(&buf, Int32(4))
        
        
        case .quicEnabled:
            writeInt(&buf, Int32(5))
        
        
        case .exit:
            writeInt(&buf, Int32(6))
        
        
        case .vpn:
            writeInt(&buf, Int32(7))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayFilter_lift(_ buf: RustBuffer) throws -> GatewayFilter {
    return try FfiConverterTypeGatewayFilter.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayFilter_lower(_ value: GatewayFilter) -> RustBuffer {
    return FfiConverterTypeGatewayFilter.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum GatewayType: Equatable, Hashable {
    
    case mixnetEntry
    case mixnetExit
    case wg



}

#if compiler(>=6)
extension GatewayType: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGatewayType: FfiConverterRustBuffer {
    typealias SwiftType = GatewayType

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GatewayType {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .mixnetEntry
        
        case 2: return .mixnetExit
        
        case 3: return .wg
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: GatewayType, into buf: inout [UInt8]) {
        switch value {
        
        
        case .mixnetEntry:
            writeInt(&buf, Int32(1))
        
        
        case .mixnetExit:
            writeInt(&buf, Int32(2))
        
        
        case .wg:
            writeInt(&buf, Int32(3))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayType_lift(_ buf: RustBuffer) throws -> GatewayType {
    return try FfiConverterTypeGatewayType.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGatewayType_lower(_ value: GatewayType) -> RustBuffer {
    return FfiConverterTypeGatewayType.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum MixnetEvent: Equatable, Hashable {
    
    case bandwidth(BandwidthEvent
    )
    case connection(ConnectionEvent
    )
    case connectionStatistics(ConnectionStatisticsEvent
    )



}

#if compiler(>=6)
extension MixnetEvent: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMixnetEvent: FfiConverterRustBuffer {
    typealias SwiftType = MixnetEvent

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MixnetEvent {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .bandwidth(try FfiConverterTypeBandwidthEvent.read(from: &buf)
        )
        
        case 2: return .connection(try FfiConverterTypeConnectionEvent.read(from: &buf)
        )
        
        case 3: return .connectionStatistics(try FfiConverterTypeConnectionStatisticsEvent.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: MixnetEvent, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .bandwidth(v1):
            writeInt(&buf, Int32(1))
            FfiConverterTypeBandwidthEvent.write(v1, into: &buf)
            
        
        case let .connection(v1):
            writeInt(&buf, Int32(2))
            FfiConverterTypeConnectionEvent.write(v1, into: &buf)
            
        
        case let .connectionStatistics(v1):
            writeInt(&buf, Int32(3))
            FfiConverterTypeConnectionStatisticsEvent.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMixnetEvent_lift(_ buf: RustBuffer) throws -> MixnetEvent {
    return try FfiConverterTypeMixnetEvent.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMixnetEvent_lower(_ value: MixnetEvent) -> RustBuffer {
    return FfiConverterTypeMixnetEvent.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum NymVpnDeviceStatus: Equatable, Hashable {
    
    case active
    case inactive
    case deleteMe



}

#if compiler(>=6)
extension NymVpnDeviceStatus: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNymVpnDeviceStatus: FfiConverterRustBuffer {
    typealias SwiftType = NymVpnDeviceStatus

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NymVpnDeviceStatus {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .active
        
        case 2: return .inactive
        
        case 3: return .deleteMe
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: NymVpnDeviceStatus, into buf: inout [UInt8]) {
        switch value {
        
        
        case .active:
            writeInt(&buf, Int32(1))
        
        
        case .inactive:
            writeInt(&buf, Int32(2))
        
        
        case .deleteMe:
            writeInt(&buf, Int32(3))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnDeviceStatus_lift(_ buf: RustBuffer) throws -> NymVpnDeviceStatus {
    return try FfiConverterTypeNymVpnDeviceStatus.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNymVpnDeviceStatus_lower(_ value: NymVpnDeviceStatus) -> RustBuffer {
    return FfiConverterTypeNymVpnDeviceStatus.lower(value)
}



public enum RequestZkNymError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {

    
    
    case GetZkNymsAvailableForDownloadEndpointFailure(response: VpnApiError
    )
    case CreateEcashKeyPair(String
    )
    case ConstructWithdrawalRequest(String
    )
    case RequestZkNymEndpointFailure(ticketType: String, response: VpnApiError
    )
    case InvalidTicketTypeInResponse(String
    )
    case TicketTypeMismatch
    case PollZkNymEndpointFailure(response: VpnApiError
    )
    case PollingTimeout(id: String
    )
    case MissingBlindedShares
    case ResponseHasInvalidMasterVerificationKey(String
    )
    case EpochIdMismatch
    case ExpirationDateMismatch
    case GetPartialVerificationKeysEndpointFailure(epochId: UInt64, response: VpnApiError
    )
    case NoMasterVerificationKeyInStorage
    case NoCoinIndexSignaturesInStorage
    case NoExpirationDateSignaturesInStorage
    case InvalidVerificationKey(String
    )
    case DeserializeBlindedSignature(String
    )
    case DecodedKeysMissingIndex
    case ImportZkNym(ticketType: String, error: String
    )
    case AggregateWallets(String
    )
    case ConfirmZkNymDownloadEndpointFailure(id: String, response: VpnApiError
    )
    case MissingPendingRequest(String
    )
    case CredentialStorage(String
    )
    case UnexpectedErrorResponse(String
    )
    case ZkNymRevoked
    case IssuanceError
    case MalformedUpgradeModeJwt
    case InconsistentResponse(reason: String
    )
    case Internal(String
    )

    

    
    public var errorDescription: String? {
        String(reflecting: self)
    }
    
}

#if compiler(>=6)
extension RequestZkNymError: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRequestZkNymError: FfiConverterRustBuffer {
    typealias SwiftType = RequestZkNymError

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RequestZkNymError {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        

        
        case 1: return .GetZkNymsAvailableForDownloadEndpointFailure(
            response: try FfiConverterTypeVpnApiError.read(from: &buf)
            )
        case 2: return .CreateEcashKeyPair(
            try FfiConverterString.read(from: &buf)
            )
        case 3: return .ConstructWithdrawalRequest(
            try FfiConverterString.read(from: &buf)
            )
        case 4: return .RequestZkNymEndpointFailure(
            ticketType: try FfiConverterString.read(from: &buf), 
            response: try FfiConverterTypeVpnApiError.read(from: &buf)
            )
        case 5: return .InvalidTicketTypeInResponse(
            try FfiConverterString.read(from: &buf)
            )
        case 6: return .TicketTypeMismatch
        case 7: return .PollZkNymEndpointFailure(
            response: try FfiConverterTypeVpnApiError.read(from: &buf)
            )
        case 8: return .PollingTimeout(
            id: try FfiConverterString.read(from: &buf)
            )
        case 9: return .MissingBlindedShares
        case 10: return .ResponseHasInvalidMasterVerificationKey(
            try FfiConverterString.read(from: &buf)
            )
        case 11: return .EpochIdMismatch
        case 12: return .ExpirationDateMismatch
        case 13: return .GetPartialVerificationKeysEndpointFailure(
            epochId: try FfiConverterUInt64.read(from: &buf), 
            response: try FfiConverterTypeVpnApiError.read(from: &buf)
            )
        case 14: return .NoMasterVerificationKeyInStorage
        case 15: return .NoCoinIndexSignaturesInStorage
        case 16: return .NoExpirationDateSignaturesInStorage
        case 17: return .InvalidVerificationKey(
            try FfiConverterString.read(from: &buf)
            )
        case 18: return .DeserializeBlindedSignature(
            try FfiConverterString.read(from: &buf)
            )
        case 19: return .DecodedKeysMissingIndex
        case 20: return .ImportZkNym(
            ticketType: try FfiConverterString.read(from: &buf), 
            error: try FfiConverterString.read(from: &buf)
            )
        case 21: return .AggregateWallets(
            try FfiConverterString.read(from: &buf)
            )
        case 22: return .ConfirmZkNymDownloadEndpointFailure(
            id: try FfiConverterString.read(from: &buf), 
            response: try FfiConverterTypeVpnApiError.read(from: &buf)
            )
        case 23: return .MissingPendingRequest(
            try FfiConverterString.read(from: &buf)
            )
        case 24: return .CredentialStorage(
            try FfiConverterString.read(from: &buf)
            )
        case 25: return .UnexpectedErrorResponse(
            try FfiConverterString.read(from: &buf)
            )
        case 26: return .ZkNymRevoked
        case 27: return .IssuanceError
        case 28: return .MalformedUpgradeModeJwt
        case 29: return .InconsistentResponse(
            reason: try FfiConverterString.read(from: &buf)
            )
        case 30: return .Internal(
            try FfiConverterString.read(from: &buf)
            )

         default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: RequestZkNymError, into buf: inout [UInt8]) {
        switch value {

        

        
        
        case let .GetZkNymsAvailableForDownloadEndpointFailure(response):
            writeInt(&buf, Int32(1))
            FfiConverterTypeVpnApiError.write(response, into: &buf)
            
        
        case let .CreateEcashKeyPair(v1):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .ConstructWithdrawalRequest(v1):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .RequestZkNymEndpointFailure(ticketType,response):
            writeInt(&buf, Int32(4))
            FfiConverterString.write(ticketType, into: &buf)
            FfiConverterTypeVpnApiError.write(response, into: &buf)
            
        
        case let .InvalidTicketTypeInResponse(v1):
            writeInt(&buf, Int32(5))
            FfiConverterString.write(v1, into: &buf)
            
        
        case .TicketTypeMismatch:
            writeInt(&buf, Int32(6))
        
        
        case let .PollZkNymEndpointFailure(response):
            writeInt(&buf, Int32(7))
            FfiConverterTypeVpnApiError.write(response, into: &buf)
            
        
        case let .PollingTimeout(id):
            writeInt(&buf, Int32(8))
            FfiConverterString.write(id, into: &buf)
            
        
        case .MissingBlindedShares:
            writeInt(&buf, Int32(9))
        
        
        case let .ResponseHasInvalidMasterVerificationKey(v1):
            writeInt(&buf, Int32(10))
            FfiConverterString.write(v1, into: &buf)
            
        
        case .EpochIdMismatch:
            writeInt(&buf, Int32(11))
        
        
        case .ExpirationDateMismatch:
            writeInt(&buf, Int32(12))
        
        
        case let .GetPartialVerificationKeysEndpointFailure(epochId,response):
            writeInt(&buf, Int32(13))
            FfiConverterUInt64.write(epochId, into: &buf)
            FfiConverterTypeVpnApiError.write(response, into: &buf)
            
        
        case .NoMasterVerificationKeyInStorage:
            writeInt(&buf, Int32(14))
        
        
        case .NoCoinIndexSignaturesInStorage:
            writeInt(&buf, Int32(15))
        
        
        case .NoExpirationDateSignaturesInStorage:
            writeInt(&buf, Int32(16))
        
        
        case let .InvalidVerificationKey(v1):
            writeInt(&buf, Int32(17))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .DeserializeBlindedSignature(v1):
            writeInt(&buf, Int32(18))
            FfiConverterString.write(v1, into: &buf)
            
        
        case .DecodedKeysMissingIndex:
            writeInt(&buf, Int32(19))
        
        
        case let .ImportZkNym(ticketType,error):
            writeInt(&buf, Int32(20))
            FfiConverterString.write(ticketType, into: &buf)
            FfiConverterString.write(error, into: &buf)
            
        
        case let .AggregateWallets(v1):
            writeInt(&buf, Int32(21))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .ConfirmZkNymDownloadEndpointFailure(id,response):
            writeInt(&buf, Int32(22))
            FfiConverterString.write(id, into: &buf)
            FfiConverterTypeVpnApiError.write(response, into: &buf)
            
        
        case let .MissingPendingRequest(v1):
            writeInt(&buf, Int32(23))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .CredentialStorage(v1):
            writeInt(&buf, Int32(24))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .UnexpectedErrorResponse(v1):
            writeInt(&buf, Int32(25))
            FfiConverterString.write(v1, into: &buf)
            
        
        case .ZkNymRevoked:
            writeInt(&buf, Int32(26))
        
        
        case .IssuanceError:
            writeInt(&buf, Int32(27))
        
        
        case .MalformedUpgradeModeJwt:
            writeInt(&buf, Int32(28))
        
        
        case let .InconsistentResponse(reason):
            writeInt(&buf, Int32(29))
            FfiConverterString.write(reason, into: &buf)
            
        
        case let .Internal(v1):
            writeInt(&buf, Int32(30))
            FfiConverterString.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRequestZkNymError_lift(_ buf: RustBuffer) throws -> RequestZkNymError {
    return try FfiConverterTypeRequestZkNymError.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRequestZkNymError_lower(_ value: RequestZkNymError) -> RustBuffer {
    return FfiConverterTypeRequestZkNymError.lower(value)
}

// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum RequestZkNymSuccess: Equatable, Hashable {
    
    case ticketbook(id: String, ticketbookType: String
    )
    case upgradeMode(id: String
    )



}

#if compiler(>=6)
extension RequestZkNymSuccess: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRequestZkNymSuccess: FfiConverterRustBuffer {
    typealias SwiftType = RequestZkNymSuccess

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RequestZkNymSuccess {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .ticketbook(id: try FfiConverterString.read(from: &buf), ticketbookType: try FfiConverterString.read(from: &buf)
        )
        
        case 2: return .upgradeMode(id: try FfiConverterString.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: RequestZkNymSuccess, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .ticketbook(id,ticketbookType):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(id, into: &buf)
            FfiConverterString.write(ticketbookType, into: &buf)
            
        
        case let .upgradeMode(id):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(id, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRequestZkNymSuccess_lift(_ buf: RustBuffer) throws -> RequestZkNymSuccess {
    return try FfiConverterTypeRequestZkNymSuccess.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRequestZkNymSuccess_lower(_ value: RequestZkNymSuccess) -> RustBuffer {
    return FfiConverterTypeRequestZkNymSuccess.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum Score: Equatable, Hashable {
    
    case high
    case medium
    case low
    case offline



}

#if compiler(>=6)
extension Score: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeScore: FfiConverterRustBuffer {
    typealias SwiftType = Score

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Score {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .high
        
        case 2: return .medium
        
        case 3: return .low
        
        case 4: return .offline
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: Score, into buf: inout [UInt8]) {
        switch value {
        
        
        case .high:
            writeInt(&buf, Int32(1))
        
        
        case .medium:
            writeInt(&buf, Int32(2))
        
        
        case .low:
            writeInt(&buf, Int32(3))
        
        
        case .offline:
            writeInt(&buf, Int32(4))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeScore_lift(_ buf: RustBuffer) throws -> Score {
    return try FfiConverterTypeScore.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeScore_lower(_ value: Score) -> RustBuffer {
    return FfiConverterTypeScore.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
/**
 * SOCKS5 service state
 */

public enum Socks5State: Equatable, Hashable {
    
    /**
     * Service is disabled
     */
    case disabled
    /**
     * Enabled but no active connections (mixnet client not running)
     */
    case idle
    /**
     * Active connections, mixnet client is running
     */
    case connected
    /**
     * Error state
     */
    case error



}

#if compiler(>=6)
extension Socks5State: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSocks5State: FfiConverterRustBuffer {
    typealias SwiftType = Socks5State

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Socks5State {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .disabled
        
        case 2: return .idle
        
        case 3: return .connected
        
        case 4: return .error
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: Socks5State, into buf: inout [UInt8]) {
        switch value {
        
        
        case .disabled:
            writeInt(&buf, Int32(1))
        
        
        case .idle:
            writeInt(&buf, Int32(2))
        
        
        case .connected:
            writeInt(&buf, Int32(3))
        
        
        case .error:
            writeInt(&buf, Int32(4))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocks5State_lift(_ buf: RustBuffer) throws -> Socks5State {
    return try FfiConverterTypeSocks5State.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocks5State_lower(_ value: Socks5State) -> RustBuffer {
    return FfiConverterTypeSocks5State.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum StoreAccountRequest: Equatable, Hashable {
    
    case vpn(mnemonic: String
    )
    case privy(hexSignature: String
    )
    case decentralised(mnemonic: String
    )



}

#if compiler(>=6)
extension StoreAccountRequest: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeStoreAccountRequest: FfiConverterRustBuffer {
    typealias SwiftType = StoreAccountRequest

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> StoreAccountRequest {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .vpn(mnemonic: try FfiConverterString.read(from: &buf)
        )
        
        case 2: return .privy(hexSignature: try FfiConverterString.read(from: &buf)
        )
        
        case 3: return .decentralised(mnemonic: try FfiConverterString.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: StoreAccountRequest, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .vpn(mnemonic):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(mnemonic, into: &buf)
            
        
        case let .privy(hexSignature):
            writeInt(&buf, Int32(2))
            FfiConverterString.write(hexSignature, into: &buf)
            
        
        case let .decentralised(mnemonic):
            writeInt(&buf, Int32(3))
            FfiConverterString.write(mnemonic, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeStoreAccountRequest_lift(_ buf: RustBuffer) throws -> StoreAccountRequest {
    return try FfiConverterTypeStoreAccountRequest.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeStoreAccountRequest_lower(_ value: StoreAccountRequest) -> RustBuffer {
    return FfiConverterTypeStoreAccountRequest.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
/**
 * The target tunnel state.
 */

public enum TargetState: Equatable, Hashable {
    
    /**
     * Unsecure the device.
     */
    case unsecured
    /**
     * Secure the device.
     */
    case secured



}

#if compiler(>=6)
extension TargetState: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeTargetState: FfiConverterRustBuffer {
    typealias SwiftType = TargetState

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TargetState {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .unsecured
        
        case 2: return .secured
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: TargetState, into buf: inout [UInt8]) {
        switch value {
        
        
        case .unsecured:
            writeInt(&buf, Int32(1))
        
        
        case .secured:
            writeInt(&buf, Int32(2))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTargetState_lift(_ buf: RustBuffer) throws -> TargetState {
    return try FfiConverterTypeTargetState.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTargetState_lower(_ value: TargetState) -> RustBuffer {
    return FfiConverterTypeTargetState.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum TunnelConnectionData: Equatable, Hashable {
    
    case mixnet(MixnetConnectionData
    )
    case wireguard(WireguardConnectionData
    )



}

#if compiler(>=6)
extension TunnelConnectionData: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeTunnelConnectionData: FfiConverterRustBuffer {
    typealias SwiftType = TunnelConnectionData

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TunnelConnectionData {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .mixnet(try FfiConverterTypeMixnetConnectionData.read(from: &buf)
        )
        
        case 2: return .wireguard(try FfiConverterTypeWireguardConnectionData.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: TunnelConnectionData, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .mixnet(v1):
            writeInt(&buf, Int32(1))
            FfiConverterTypeMixnetConnectionData.write(v1, into: &buf)
            
        
        case let .wireguard(v1):
            writeInt(&buf, Int32(2))
            FfiConverterTypeWireguardConnectionData.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelConnectionData_lift(_ buf: RustBuffer) throws -> TunnelConnectionData {
    return try FfiConverterTypeTunnelConnectionData.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelConnectionData_lower(_ value: TunnelConnectionData) -> RustBuffer {
    return FfiConverterTypeTunnelConnectionData.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum TunnelEvent: Equatable, Hashable {
    
    case newState(TunnelState
    )
    case mixnetState(MixnetEvent
    )
    case configChanged(BoxedVpnServiceConfig
    )
    case accountState(AccountControllerState
    )



}

#if compiler(>=6)
extension TunnelEvent: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeTunnelEvent: FfiConverterRustBuffer {
    typealias SwiftType = TunnelEvent

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TunnelEvent {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .newState(try FfiConverterTypeTunnelState.read(from: &buf)
        )
        
        case 2: return .mixnetState(try FfiConverterTypeMixnetEvent.read(from: &buf)
        )
        
        case 3: return .configChanged(try FfiConverterTypeBoxedVpnServiceConfig.read(from: &buf)
        )
        
        case 4: return .accountState(try FfiConverterTypeAccountControllerState.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: TunnelEvent, into buf: inout [UInt8]) {
        switch value {
        
        
        case let .newState(v1):
            writeInt(&buf, Int32(1))
            FfiConverterTypeTunnelState.write(v1, into: &buf)
            
        
        case let .mixnetState(v1):
            writeInt(&buf, Int32(2))
            FfiConverterTypeMixnetEvent.write(v1, into: &buf)
            
        
        case let .configChanged(v1):
            writeInt(&buf, Int32(3))
            FfiConverterTypeBoxedVpnServiceConfig.write(v1, into: &buf)
            
        
        case let .accountState(v1):
            writeInt(&buf, Int32(4))
            FfiConverterTypeAccountControllerState.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelEvent_lift(_ buf: RustBuffer) throws -> TunnelEvent {
    return try FfiConverterTypeTunnelEvent.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelEvent_lower(_ value: TunnelEvent) -> RustBuffer {
    return FfiConverterTypeTunnelEvent.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
/**
 * Public enum describing the tunnel state
 */

public enum TunnelState: Equatable, Hashable {
    
    /**
     * Tunnel is disconnected and network connectivity is available.
     */
    case disconnected
    /**
     * Tunnel connection is being established.
     */
    case connecting(retryAttempt: UInt32, state: EstablishConnectionState, tunnelType: TunnelType, connectionData: EstablishConnectionData?
    )
    /**
     * Tunnel is connected.
     */
    case connected(connectionData: ConnectionData
    )
    /**
     * Tunnel is disconnecting.
     */
    case disconnecting(afterDisconnect: ActionAfterDisconnect
    )
    /**
     * Tunnel is disconnected due to failure.
     */
    case error(ErrorStateReason
    )
    /**
     * Tunnel is disconnected, network connectivity is unavailable.
     */
    case offline(
        /**
         * Whether tunnel will be reconnected upon gaining the network connectivity.
         */reconnect: Bool
    )



}

#if compiler(>=6)
extension TunnelState: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeTunnelState: FfiConverterRustBuffer {
    typealias SwiftType = TunnelState

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TunnelState {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .disconnected
        
        case 2: return .connecting(retryAttempt: try FfiConverterUInt32.read(from: &buf), state: try FfiConverterTypeEstablishConnectionState.read(from: &buf), tunnelType: try FfiConverterTypeTunnelType.read(from: &buf), connectionData: try FfiConverterOptionTypeEstablishConnectionData.read(from: &buf)
        )
        
        case 3: return .connected(connectionData: try FfiConverterTypeConnectionData.read(from: &buf)
        )
        
        case 4: return .disconnecting(afterDisconnect: try FfiConverterTypeActionAfterDisconnect.read(from: &buf)
        )
        
        case 5: return .error(try FfiConverterTypeErrorStateReason.read(from: &buf)
        )
        
        case 6: return .offline(reconnect: try FfiConverterBool.read(from: &buf)
        )
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: TunnelState, into buf: inout [UInt8]) {
        switch value {
        
        
        case .disconnected:
            writeInt(&buf, Int32(1))
        
        
        case let .connecting(retryAttempt,state,tunnelType,connectionData):
            writeInt(&buf, Int32(2))
            FfiConverterUInt32.write(retryAttempt, into: &buf)
            FfiConverterTypeEstablishConnectionState.write(state, into: &buf)
            FfiConverterTypeTunnelType.write(tunnelType, into: &buf)
            FfiConverterOptionTypeEstablishConnectionData.write(connectionData, into: &buf)
            
        
        case let .connected(connectionData):
            writeInt(&buf, Int32(3))
            FfiConverterTypeConnectionData.write(connectionData, into: &buf)
            
        
        case let .disconnecting(afterDisconnect):
            writeInt(&buf, Int32(4))
            FfiConverterTypeActionAfterDisconnect.write(afterDisconnect, into: &buf)
            
        
        case let .error(v1):
            writeInt(&buf, Int32(5))
            FfiConverterTypeErrorStateReason.write(v1, into: &buf)
            
        
        case let .offline(reconnect):
            writeInt(&buf, Int32(6))
            FfiConverterBool.write(reconnect, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelState_lift(_ buf: RustBuffer) throws -> TunnelState {
    return try FfiConverterTypeTunnelState.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelState_lower(_ value: TunnelState) -> RustBuffer {
    return FfiConverterTypeTunnelState.lower(value)
}


// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.

public enum TunnelType: Equatable, Hashable {
    
    case mixnet
    case wireguard



}

#if compiler(>=6)
extension TunnelType: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeTunnelType: FfiConverterRustBuffer {
    typealias SwiftType = TunnelType

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TunnelType {
        let variant: Int32 = try readInt(&buf)
        switch variant {
        
        case 1: return .mixnet
        
        case 2: return .wireguard
        
        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: TunnelType, into buf: inout [UInt8]) {
        switch value {
        
        
        case .mixnet:
            writeInt(&buf, Int32(1))
        
        
        case .wireguard:
            writeInt(&buf, Int32(2))
        
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelType_lift(_ buf: RustBuffer) throws -> TunnelType {
    return try FfiConverterTypeTunnelType.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeTunnelType_lower(_ value: TunnelType) -> RustBuffer {
    return FfiConverterTypeTunnelType.lower(value)
}



public enum VpnApiError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {

    
    
    case Timeout(String
    )
    case StatusCode(code: UInt16, msg: String
    )
    case Response(VpnApiErrorResponse
    )

    

    
    public var errorDescription: String? {
        String(reflecting: self)
    }
    
}

#if compiler(>=6)
extension VpnApiError: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeVpnApiError: FfiConverterRustBuffer {
    typealias SwiftType = VpnApiError

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VpnApiError {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        

        
        case 1: return .Timeout(
            try FfiConverterString.read(from: &buf)
            )
        case 2: return .StatusCode(
            code: try FfiConverterUInt16.read(from: &buf), 
            msg: try FfiConverterString.read(from: &buf)
            )
        case 3: return .Response(
            try FfiConverterTypeVpnApiErrorResponse.read(from: &buf)
            )

         default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: VpnApiError, into buf: inout [UInt8]) {
        switch value {

        

        
        
        case let .Timeout(v1):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(v1, into: &buf)
            
        
        case let .StatusCode(code,msg):
            writeInt(&buf, Int32(2))
            FfiConverterUInt16.write(code, into: &buf)
            FfiConverterString.write(msg, into: &buf)
            
        
        case let .Response(v1):
            writeInt(&buf, Int32(3))
            FfiConverterTypeVpnApiErrorResponse.write(v1, into: &buf)
            
        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnApiError_lift(_ buf: RustBuffer) throws -> VpnApiError {
    return try FfiConverterTypeVpnApiError.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeVpnApiError_lower(_ value: VpnApiError) -> RustBuffer {
    return FfiConverterTypeVpnApiError.lower(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionUInt8: FfiConverterRustBuffer {
    typealias SwiftType = UInt8?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterUInt8.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterUInt8.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer {
    typealias SwiftType = UInt32?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterUInt32.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterUInt32.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer {
    typealias SwiftType = Bool?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterBool.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterBool.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer {
    typealias SwiftType = String?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterString.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterString.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeFeatureFlags: FfiConverterRustBuffer {
    typealias SwiftType = FeatureFlags?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeFeatureFlags.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeFeatureFlags.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeAsn: FfiConverterRustBuffer {
    typealias SwiftType = Asn?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeAsn.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeAsn.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeBridgeAddress: FfiConverterRustBuffer {
    typealias SwiftType = BridgeAddress?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeBridgeAddress.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeBridgeAddress.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeBridgeInformation: FfiConverterRustBuffer {
    typealias SwiftType = BridgeInformation?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeBridgeInformation.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeBridgeInformation.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeEstablishConnectionData: FfiConverterRustBuffer {
    typealias SwiftType = EstablishConnectionData?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeEstablishConnectionData.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeEstablishConnectionData.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeExit: FfiConverterRustBuffer {
    typealias SwiftType = Exit?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeExit.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeExit.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeLocation: FfiConverterRustBuffer {
    typealias SwiftType = Location?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeLocation.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeLocation.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeNetworkCompatibility: FfiConverterRustBuffer {
    typealias SwiftType = NetworkCompatibility?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeNetworkCompatibility.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeNetworkCompatibility.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypePerformance: FfiConverterRustBuffer {
    typealias SwiftType = Performance?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypePerformance.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypePerformance.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeProbe: FfiConverterRustBuffer {
    typealias SwiftType = Probe?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeProbe.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeProbe.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeSystemConfiguration: FfiConverterRustBuffer {
    typealias SwiftType = SystemConfiguration?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeSystemConfiguration.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeSystemConfiguration.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeUserAgent: FfiConverterRustBuffer {
    typealias SwiftType = UserAgent?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeUserAgent.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeUserAgent.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeAccountCommandError: FfiConverterRustBuffer {
    typealias SwiftType = AccountCommandError?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeAccountCommandError.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeAccountCommandError.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeTunnelConnectionData: FfiConverterRustBuffer {
    typealias SwiftType = TunnelConnectionData?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeTunnelConnectionData.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeTunnelConnectionData.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionSequenceString: FfiConverterRustBuffer {
    typealias SwiftType = [String]?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterSequenceString.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterSequenceString.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionSequenceTypeApiUrl: FfiConverterRustBuffer {
    typealias SwiftType = [ApiUrl]?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterSequenceTypeApiUrl.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterSequenceTypeApiUrl.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionDictionaryStringString: FfiConverterRustBuffer {
    typealias SwiftType = [String: String]?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterDictionaryStringString.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterDictionaryStringString.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeIpv6Addr: FfiConverterRustBuffer {
    typealias SwiftType = Ipv6Addr?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeIpv6Addr.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeIpv6Addr.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeOffsetDateTime: FfiConverterRustBuffer {
    typealias SwiftType = OffsetDateTime?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeOffsetDateTime.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeOffsetDateTime.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeSocketAddr: FfiConverterRustBuffer {
    typealias SwiftType = SocketAddr?

    public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
        guard let value = value else {
            writeInt(&buf, Int8(0))
            return
        }
        writeInt(&buf, Int8(1))
        FfiConverterTypeSocketAddr.write(value, into: &buf)
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
        switch try readInt(&buf) as Int8 {
        case 0: return nil
        case 1: return try FfiConverterTypeSocketAddr.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer {
    typealias SwiftType = [String]

    public static func write(_ value: [String], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterString.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String] {
        let len: Int32 = try readInt(&buf)
        var seq = [String]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterString.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeApiUrl: FfiConverterRustBuffer {
    typealias SwiftType = [ApiUrl]

    public static func write(_ value: [ApiUrl], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeApiUrl.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ApiUrl] {
        let len: Int32 = try readInt(&buf)
        var seq = [ApiUrl]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeApiUrl.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeValidatorDetails: FfiConverterRustBuffer {
    typealias SwiftType = [ValidatorDetails]

    public static func write(_ value: [ValidatorDetails], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeValidatorDetails.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ValidatorDetails] {
        let len: Int32 = try readInt(&buf)
        var seq = [ValidatorDetails]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeValidatorDetails.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeBridgeParameters: FfiConverterRustBuffer {
    typealias SwiftType = [BridgeParameters]

    public static func write(_ value: [BridgeParameters], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeBridgeParameters.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [BridgeParameters] {
        let len: Int32 = try readInt(&buf)
        var seq = [BridgeParameters]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeBridgeParameters.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeGatewayFilter: FfiConverterRustBuffer {
    typealias SwiftType = [GatewayFilter]

    public static func write(_ value: [GatewayFilter], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeGatewayFilter.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [GatewayFilter] {
        let len: Int32 = try readInt(&buf)
        var seq = [GatewayFilter]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeGatewayFilter.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeIpAddr: FfiConverterRustBuffer {
    typealias SwiftType = [IpAddr]

    public static func write(_ value: [IpAddr], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeIpAddr.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [IpAddr] {
        let len: Int32 = try readInt(&buf)
        var seq = [IpAddr]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeIpAddr.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeIpv4Addr: FfiConverterRustBuffer {
    typealias SwiftType = [Ipv4Addr]

    public static func write(_ value: [Ipv4Addr], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeIpv4Addr.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Ipv4Addr] {
        let len: Int32 = try readInt(&buf)
        var seq = [Ipv4Addr]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeIpv4Addr.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeIpv6Addr: FfiConverterRustBuffer {
    typealias SwiftType = [Ipv6Addr]

    public static func write(_ value: [Ipv6Addr], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeIpv6Addr.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Ipv6Addr] {
        let len: Int32 = try readInt(&buf)
        var seq = [Ipv6Addr]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeIpv6Addr.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeSocketAddr: FfiConverterRustBuffer {
    typealias SwiftType = [SocketAddr]

    public static func write(_ value: [SocketAddr], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeSocketAddr.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [SocketAddr] {
        let len: Int32 = try readInt(&buf)
        var seq = [SocketAddr]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeSocketAddr.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterDictionaryStringString: FfiConverterRustBuffer {
    public static func write(_ value: [String: String], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for (key, value) in value {
            FfiConverterString.write(key, into: &buf)
            FfiConverterString.write(value, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: String] {
        let len: Int32 = try readInt(&buf)
        var dict = [String: String]()
        dict.reserveCapacity(Int(len))
        for _ in 0..<len {
            let key = try FfiConverterString.read(from: &buf)
            let value = try FfiConverterString.read(from: &buf)
            dict[key] = value
        }
        return dict
    }
}


/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias BoxedNodeIdentity = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBoxedNodeIdentity: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BoxedNodeIdentity {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: BoxedNodeIdentity, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> BoxedNodeIdentity {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: BoxedNodeIdentity) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBoxedNodeIdentity_lift(_ value: RustBuffer) throws -> BoxedNodeIdentity {
    return try FfiConverterTypeBoxedNodeIdentity.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBoxedNodeIdentity_lower(_ value: BoxedNodeIdentity) -> RustBuffer {
    return FfiConverterTypeBoxedNodeIdentity.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias BoxedRecepient = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBoxedRecepient: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BoxedRecepient {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: BoxedRecepient, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> BoxedRecepient {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: BoxedRecepient) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBoxedRecepient_lift(_ value: RustBuffer) throws -> BoxedRecepient {
    return try FfiConverterTypeBoxedRecepient.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBoxedRecepient_lower(_ value: BoxedRecepient) -> RustBuffer {
    return FfiConverterTypeBoxedRecepient.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias BoxedVpnServiceConfig = VpnServiceConfig

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeBoxedVpnServiceConfig: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BoxedVpnServiceConfig {
        return try FfiConverterTypeVpnServiceConfig.read(from: &buf)
    }

    public static func write(_ value: BoxedVpnServiceConfig, into buf: inout [UInt8]) {
        return FfiConverterTypeVpnServiceConfig.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> BoxedVpnServiceConfig {
        return try FfiConverterTypeVpnServiceConfig_lift(value)
    }

    public static func lower(_ value: BoxedVpnServiceConfig) -> RustBuffer {
        return FfiConverterTypeVpnServiceConfig_lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBoxedVpnServiceConfig_lift(_ value: RustBuffer) throws -> BoxedVpnServiceConfig {
    return try FfiConverterTypeBoxedVpnServiceConfig.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeBoxedVpnServiceConfig_lower(_ value: BoxedVpnServiceConfig) -> RustBuffer {
    return FfiConverterTypeBoxedVpnServiceConfig.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias IpAddr = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIpAddr: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IpAddr {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: IpAddr, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> IpAddr {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: IpAddr) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpAddr_lift(_ value: RustBuffer) throws -> IpAddr {
    return try FfiConverterTypeIpAddr.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpAddr_lower(_ value: IpAddr) -> RustBuffer {
    return FfiConverterTypeIpAddr.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias IpNetwork = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIpNetwork: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IpNetwork {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: IpNetwork, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> IpNetwork {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: IpNetwork) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpNetwork_lift(_ value: RustBuffer) throws -> IpNetwork {
    return try FfiConverterTypeIpNetwork.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpNetwork_lower(_ value: IpNetwork) -> RustBuffer {
    return FfiConverterTypeIpNetwork.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias Ipv4Addr = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIpv4Addr: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Ipv4Addr {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: Ipv4Addr, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> Ipv4Addr {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: Ipv4Addr) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv4Addr_lift(_ value: RustBuffer) throws -> Ipv4Addr {
    return try FfiConverterTypeIpv4Addr.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv4Addr_lower(_ value: Ipv4Addr) -> RustBuffer {
    return FfiConverterTypeIpv4Addr.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias Ipv4Network = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIpv4Network: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Ipv4Network {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: Ipv4Network, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> Ipv4Network {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: Ipv4Network) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv4Network_lift(_ value: RustBuffer) throws -> Ipv4Network {
    return try FfiConverterTypeIpv4Network.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv4Network_lower(_ value: Ipv4Network) -> RustBuffer {
    return FfiConverterTypeIpv4Network.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias Ipv6Addr = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIpv6Addr: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Ipv6Addr {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: Ipv6Addr, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> Ipv6Addr {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: Ipv6Addr) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv6Addr_lift(_ value: RustBuffer) throws -> Ipv6Addr {
    return try FfiConverterTypeIpv6Addr.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv6Addr_lower(_ value: Ipv6Addr) -> RustBuffer {
    return FfiConverterTypeIpv6Addr.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias Ipv6Network = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIpv6Network: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Ipv6Network {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: Ipv6Network, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> Ipv6Network {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: Ipv6Network) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv6Network_lift(_ value: RustBuffer) throws -> Ipv6Network {
    return try FfiConverterTypeIpv6Network.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIpv6Network_lower(_ value: Ipv6Network) -> RustBuffer {
    return FfiConverterTypeIpv6Network.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias NodeIdentity = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNodeIdentity: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NodeIdentity {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: NodeIdentity, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> NodeIdentity {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: NodeIdentity) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNodeIdentity_lift(_ value: RustBuffer) throws -> NodeIdentity {
    return try FfiConverterTypeNodeIdentity.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNodeIdentity_lower(_ value: NodeIdentity) -> RustBuffer {
    return FfiConverterTypeNodeIdentity.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias OffsetDateTime = Int64

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeOffsetDateTime: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OffsetDateTime {
        return try FfiConverterInt64.read(from: &buf)
    }

    public static func write(_ value: OffsetDateTime, into buf: inout [UInt8]) {
        return FfiConverterInt64.write(value, into: &buf)
    }

    public static func lift(_ value: Int64) throws -> OffsetDateTime {
        return try FfiConverterInt64.lift(value)
    }

    public static func lower(_ value: OffsetDateTime) -> Int64 {
        return FfiConverterInt64.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeOffsetDateTime_lift(_ value: Int64) throws -> OffsetDateTime {
    return try FfiConverterTypeOffsetDateTime.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeOffsetDateTime_lower(_ value: OffsetDateTime) -> Int64 {
    return FfiConverterTypeOffsetDateTime.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias PathBuf = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePathBuf: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PathBuf {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: PathBuf, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> PathBuf {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: PathBuf) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePathBuf_lift(_ value: RustBuffer) throws -> PathBuf {
    return try FfiConverterTypePathBuf.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePathBuf_lower(_ value: PathBuf) -> RustBuffer {
    return FfiConverterTypePathBuf.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias Recipient = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRecipient: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Recipient {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: Recipient, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> Recipient {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: Recipient) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRecipient_lift(_ value: RustBuffer) throws -> Recipient {
    return try FfiConverterTypeRecipient.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRecipient_lower(_ value: Recipient) -> RustBuffer {
    return FfiConverterTypeRecipient.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias SocketAddr = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSocketAddr: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SocketAddr {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: SocketAddr, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> SocketAddr {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: SocketAddr) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocketAddr_lift(_ value: RustBuffer) throws -> SocketAddr {
    return try FfiConverterTypeSocketAddr.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSocketAddr_lower(_ value: SocketAddr) -> RustBuffer {
    return FfiConverterTypeSocketAddr.lower(value)
}



/**
 * Typealias from the type name used in the UDL file to the builtin type.  This
 * is needed because the UDL type name is used in function/method signatures.
 */
public typealias U128 = String

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeu128: FfiConverter {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> U128 {
        return try FfiConverterString.read(from: &buf)
    }

    public static func write(_ value: U128, into buf: inout [UInt8]) {
        return FfiConverterString.write(value, into: &buf)
    }

    public static func lift(_ value: RustBuffer) throws -> U128 {
        return try FfiConverterString.lift(value)
    }

    public static func lower(_ value: U128) -> RustBuffer {
        return FfiConverterString.lower(value)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeu128_lift(_ value: RustBuffer) throws -> U128 {
    return try FfiConverterTypeu128.lift(value)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeu128_lower(_ value: U128) -> RustBuffer {
    return FfiConverterTypeu128.lower(value)
}


private enum InitializationResult {
    case ok
    case contractVersionMismatch
    case apiChecksumMismatch
}
// Use a global variable to perform the versioning checks. Swift ensures that
// the code inside is only computed once.
private let initializationResult: InitializationResult = {
    // Get the bindings contract version from our ComponentInterface
    let bindings_contract_version = 30
    // Get the scaffolding contract version by calling the into the dylib
    let scaffolding_contract_version = ffi_nym_vpn_lib_types_uniffi_contract_version()
    if bindings_contract_version != scaffolding_contract_version {
        return InitializationResult.contractVersionMismatch
    }
    if (uniffi_nym_vpn_lib_types_checksum_method_featureflags_get_group_flag() != 28240) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_nym_vpn_lib_types_checksum_method_featureflags_is_domain_fronting_enabled() != 31141) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_nym_vpn_lib_types_checksum_method_featureflags_is_privy_enabled() != 34579) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_nym_vpn_lib_types_checksum_method_featureflags_is_quic_enabled() != 65239) {
        return InitializationResult.apiChecksumMismatch
    }

    return InitializationResult.ok
}()

// Make the ensure init function public so that other modules which have external type references to
// our types can call it.
public func uniffiEnsureNymVpnLibTypesInitialized() {
    switch initializationResult {
    case .ok:
        break
    case .contractVersionMismatch:
        fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
    case .apiChecksumMismatch:
        fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    }
}

// swiftlint:enable all