Skip to content

LebJe/ICMPPing

Repository files navigation

ICMPPing

Send ICMP Ping requests in Swift! Powered by cpp-icmplib.

Swift 5.5 SPM Compatible Build and Test

Installation

Swift Package Manager

Add this to the dependencies array in Package.swift:

.package(url: "https://github.com/LebJe/ICMPPing.git", from: "0.0.1")

Also add this to the targets array in the aforementioned file:

.product(name: "ICMPPing", package: "ICMPPing")

Full Documentation

Full documentation is available here.

Quick Start

import ICMPPing

// Google's IP Address
let address = try ICMPPing.IPAddress("8.8.8.8", type: .ipv4)

let result = ICMPPing.ping(address: address, timeout: 10 /* seconds */)

print(result)

// ICMPPing.Response(
//     address: 8.8.8.8,
//     code: 0,
//     timeToLive: 116,
//     interval: 23.011,
//     responseType: ICMPPing.Response.ResponseType.success
// )

Dependencies

Licenses

The cpp-icmplib license is available at https://github.com/markondej/cpp-icmplib/blob/c1e04b53923eec57efb898a4fdf94fea5b856c1d/LICENSE.

Contributing

Before committing, please install pre-commit, swift-format, clang-format, and Prettier, then install the pre-commit hook:

$ brew bundle # install the packages specified in Brewfile
$ pre-commit install

# Commit your changes.

To install pre-commit on other platforms, refer to the documentation.