improve porkbun credentials loading

This commit is contained in:
juancwu 2026-01-21 19:28:31 +00:00
commit 4b92d2e7c4
3 changed files with 112 additions and 77 deletions

View file

@ -0,0 +1,27 @@
package porkbun
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
)
const BaseURL = "https://api.porkbun.com/api/json/v3"
type Client struct {
APIKey string
SecretAPIKey string
HTTPClient *http.Client
}
func New(apiKey, secretKey string) *Client {
return &Client{
APIKey: apiKey,
SecretAPIKey: secretKey,
HTTPClient: &http.Client{
Timeout: 10 * time.Second,
},
}
}