DynuREST

4.1

A Dynu.com IP Update API wrapper.
richardpiazza/DynuREST

What's New

DynuREST 4.1

2024-01-07T16:54:05Z

This release focuses on better identifying routable trusted Global Unicast Addresses for IPv6.

What's Changed

Full Changelog: 4.0.0...4.1

DynuREST

A Dynu.com IP Update API wrapper.

Twitter: @richardpiazza

Face it... a REST API that responds in only text doesn't feel very modern. DynuREST translates the text responses from the Dynu.com IP Update API into proper HTTP status codes and meaningful errors.

Installation

DynuREST is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/richardpiazza/DynuREST.git", from: "3.0.0")
    ],
    ...
)

Then import the DynuREST packages wherever you'd like to use it:

import DynuREST

Usage

The DynuIPUpdater shared instance allows for sending IP information to the Dynu.com API.

let address = IPAddress.ipV4("X.X.X.X")
let response = try await DynuIPUpdater.shared.updateAddress(address, using: .basic("username", "password"))

IP address information can be obtained through any means, but DynuREST has two built-in providers:

  • IPifyClient.shared
  • IFConfigClient.shared

These both implement the IPSource protocol:

public protocol IPSource {
    func ipAddress() async throws -> IPAddress
}

DynuIPUpdater also contains a helper method which will automatically retrieve IP information from the built-in sources.

func requestIP(_ sources: [IPSource]) async -> [IPAddress]

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

Last updated: Thu Oct 17 2024 20:04:23 GMT-0900 (Hawaii-Aleutian Daylight Time)