https://github.com/libdns/nicrudns
https://github.com/libdns/nicrudns
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/libdns/nicrudns
- Owner: libdns
- License: mit
- Created: 2022-05-11T16:20:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-13T11:32:55.000Z (over 2 years ago)
- Last Synced: 2024-09-19T03:36:07.204Z (over 1 year ago)
- Language: Go
- Size: 59.6 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Golang client for NIC.ru API for [`libdns`](https://github.com/libdns/libdns)
=======================
[](https://pkg.go.dev/github.com/libdns/TODO:PROVIDER_NAME)
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for NIC.ru API, allowing you to manage DNS records.
Usage Example:
```
package examples
import (
"context"
"fmt"
"github.com/libdns/libdns"
"github.com/libdns/nicrudns"
"github.com/pkg/errors"
"time"
)
var (
provider = nicrudns.Provider{}
zoneName string
)
func ExampleLibdnsProvider() error {
ctx := context.TODO()
var records = []libdns.Record{
{
Type: `A`,
Name: `www`,
Value: `1.2.3.4`,
TTL: time.Hour,
},
}
if records, err := provider.AppendRecords(ctx, zoneName, records); err != nil {
return errors.Wrap(err, `append records error`)
} else {
for _, record := range records {
fmt.Println(record.Name, record.TTL, record.TTL, record.Value)
}
return nil
}
}
func ExampleNicruClient() error {
client := nicrudns.NewClient(&provider)
var names = []string{`www`}
if response, err := client.AddA(zoneName, names, `1.2.3.4`, `3600`); err != nil {
return errors.Wrap(err, `add records error`)
} else {
for _, rr := range response.Data.Zone[0].Rr {
fmt.Println(rr.Name, rr.Type, rr.Ttl, rr.A.String())
}
return nil
}
}
```