The Porkbun Go SDK is a fully-featured Go client for interacting with the Porkbun API v3. This SDK simplifies integration with Porkbun's services, providing an easy-to-use and comprehensive interface for managing domains, DNS records, SSL certificates, and more.
- Domain management: List, create, update, and delete domains.
- DNS management: Full control over DNS records including creation, retrieval, updating, and deletion.
- SSL management: Retrieve SSL certificate bundles for domains.
- URL forwarding: Manage domain URL forwarding settings.
- Built-in error handling and support for custom data types (e.g., BoolString, BoolNumber).
Install the SDK using go get
:
go get github.com/tuzzmaniandevil/porkbun-go
Below is a quick example demonstrating how to use the SDK to list all domains in your Porkbun account:
package main
import (
"context"
"fmt"
"log"
"github.com/tuzzmaniandevil/porkbun-go"
)
func main() {
client := porkbun.NewClient(&porkbun.Options{
ApiKey: "your_api_key",
SecretApiKey: "your_secret_api_key",
})
resp, err := client.Domains.ListDomains(context.Background(), &porkbun.DomainListOptions{})
if err != nil {
log.Fatalf("Error listing domains: %v", err)
}
for _, domain := range resp.Domains {
fmt.Println(domain.Domain)
}
}
For advanced usage, including custom API requests and handling more complex scenarios, refer to the examples directory in the repository.
Comprehensive documentation is available on GoDoc.
Run the tests using go test
:
go test ./...
Ensure you have your API credentials set up in the environment or replace them directly in the test files for local testing.
Contributions are welcome! Please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
- Write clear, concise commit messages.
- Ensure all tests pass before submitting a pull request.
- Follow the existing code style and format your code with
gofmt
.
This project is licensed under the MIT License. See the LICENSE file for details.