Swiftpack.co -  igorskh/iperf-swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
igorskh/iperf-swift
An easy to use Swift wrapper for iPerf3
.package(url: "https://github.com/igorskh/iperf-swift.git", from: "v1.2")

Swift wrapper for iPerf

An easy to use Swift wrapper for iPerf.

Usage

An appliction using this package: iPerf SwiftUI

Package implements iPerf server and client.

Usage example:

class IperfRunnerController: ObservableObject, Identifiable {
    private var iperfRunner: IperfRunner?
    
    @Published var isDeleted = false
    @Published var runnerState: IperfRunnerState = .ready
    @Published var debugDescription: String = ""
    @Published var displayError: Bool = false
    @Published var results = [IperfIntervalResult](https://raw.github.com/igorskh/iperf-swift/main/) {
        didSet {
            objectWillChange.send()
        }
    }
    
    func onResultReceived(result: IperfIntervalResult) {
        if result.streams.count > 0 {
            results.append(result)
        }
    }
    
    func onErrorReceived(error: IperfError) {
        DispatchQueue.main.async {
            self.displayError = error != .IENONE
            self.debugDescription = error.debugDescription
        }
    }
    
    func onNewState(state: IperfRunnerState) {
        if state != .unknown && state != runnerState {
            DispatchQueue.main.async {
                self.runnerState = state
            }
        }
    }
    
    func start() {
        self.formInput = formInput
        
        results = []
        debugDescription = ""
        
        iperfRunner = IperfRunner(with: IperfConfiguration())
        iperfRunner!.start(
            onResultReceived,
            onErrorReceived,
            onNewState
        )
    }
    
    func stop() {
        iperfRunner!.stop()
    }
}

Not implemented

The code which requires OpenSSL library is currently commented.

GitHub

link
Stars: 0
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Bug fix
4 weeks ago

Fixes bug with compilation error with latest Xcode version

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API