Skip to content

richardpiazza/DynuREST

DynuREST

A Dynu.com IP Update API wrapper.

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.

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]

About

A Dynu.com IP Update API wrapper.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages