Expand description
§porkbun-api
this crate provides an async implementation of porkbun’s domain management api. It provides a transport-agnostic Client, and a DefaultTransport based on hyper suitable for use in tokio-based applications.
§example
#[tokio::main]
async fn main() -> porkbun_api::Result<()> {
let api_key = porkbun_api::ApiKey::new("secret", "api_key");
let client = porkbun_api::Client::new(api_key);
let domain = &client.domains().await?[0].domain;
let subdomain = Some("my.ip");
let my_ip = client.ping().await?;
let record = CreateOrEditDnsRecord::A_or_AAAA(subdomain, my_ip);
let id = client.create(domain, record).await?;
println!("added record {id}");
client.delete(domain, &id).await?;
println!("removed record {id}");
Ok(())
}
§Features
default-client
enabled by default. Includes a default transport layer implementation for the Client. This can be disabled if you are implementing your own.
§known issues with the porkbun api
Hostnames are a subset of DNS names. 🦆.example.com
is a valid DNS name for example, but it is not a valid hostname.
The porkbun api will let you set an entry for 🦆.example.com
, but if you then try to query it, it will be returned as ??.example.com
. This is an issue with the porkbun servers.
Also, the porkbun api server can also be quite slow, sometimes taking several seconds before it accepts an api call. Keep this in mind when integrating this library within a larger application.
Modules§
- transport
- HTTP transport layer traits and implementations
Structs§
- ApiKey
- Holds the credentials needed to access the API
- Client
- A client for interfacing with the Porkbun API servers
- Create
OrEdit DnsRecord - create, or edit with a DNS record with a domain/id pair
- DnsEntry
- A DNS entry for a domain, returned by the API
- Domain
Info - A domain registration returned by the API server
- Error
- The error type that can be returned by the Client.
- Forward
- A url forwarding configuration
- Forward
WithID - An existing url forwarding configuration with an associated ID
- Label
- A label added to a domain.
- Pricing
- The default pricing for the registration, renewal and transfer of a given TLD.
- SslBundle
- The SSL certificate bundle for a domain
Enums§
- DnsRecord
Type - Valid DNS record types
- Forward
Type - The type of redirect to use
- TldType
- Describes what registry a TLD belongs to.