https://github.com/libdns/cloudns
https://github.com/libdns/cloudns
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/libdns/cloudns
- Owner: libdns
- License: mit
- Created: 2025-01-27T21:31:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-11T18:11:21.000Z (12 months ago)
- Last Synced: 2025-06-11T19:06:24.507Z (12 months ago)
- Language: Go
- Size: 24.4 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ClouDNS for [`libdns`](https://github.com/libdns/libdns)
[](https://pkg.go.dev/github.com/libdns/cloudns)
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for ClouDNS, allowing you to manage
DNS records.
## Installation
To install this package, use `go get`:
```sh
go get github.com/libdns/cloudns
```
## Usage
Here is an example of how to use this package to manage DNS records:
```go
package main
import (
"context"
"fmt"
"github.com/libdns/cloudns"
"github.com/libdns/libdns"
"time"
)
func main() {
provider := &cloudns.Provider{
AuthId: "your_auth_id",
SubAuthId: "your_sub_auth_id",
AuthPassword: "your_auth_password",
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
// Get records
records, err := provider.GetRecords(ctx, "example.com")
if err != nil {
fmt.Printf("Failed to get records: %s\n", err)
return
}
fmt.Printf("Records: %+v\n", records)
// Append a record
newRecord := libdns.Record{
Type: "TXT",
Name: "test",
Value: "test-value",
TTL: 300 * time.Second,
}
addedRecords, err := provider.AppendRecords(ctx, "example.com", []libdns.Record{newRecord})
if err != nil {
fmt.Printf("Failed to append record: %s\n", err)
return
}
fmt.Printf("Added Records: %+v\n", addedRecords)
}
```
## Configuration
The `Provider` struct has the following fields:
- `AuthId` (string, optional): Your ClouDNS authentication ID.
- `SubAuthId` (string, optional): Your ClouDNS sub-authentication ID.
- `AuthPassword` (string): Your ClouDNS authentication password.
## Testing
To run the tests, you need to set up your ClouDNS credentials and zone in the test file `provider_test.go`. The tests
require a live ClouDNS account.
```go
var (
TAuthId = "your_auth_id"
TSubAuthId = "your_sub_auth_id"
TAuthPassword = "your_auth_password"
TZone = "example.com"
)
```
Run the tests using the following command:
```sh
go test ./...
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.