Skip to content

Commit be4310b

Browse files
committed
Initial commit.
0 parents  commit be4310b

File tree

9 files changed

+698
-0
lines changed

9 files changed

+698
-0
lines changed

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
- package-ecosystem: "gomod"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"

.github/workflows/test.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
build:
14+
name: Build
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repo
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: "go.mod"
24+
check-latest: true
25+
26+
- name: Build
27+
run: go build -v ./...
28+
29+
codechecks:
30+
name: Code checks
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout repo
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Go
37+
uses: actions/setup-go@v5
38+
with:
39+
go-version-file: "go.mod"
40+
check-latest: true
41+
42+
- name: Lint
43+
uses: golangci/golangci-lint-action@v6
44+
with:
45+
args: --out-format=github-actions,line-number

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Brad Cowie
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Hurricane Electric for [`libdns`](https://github.com/libdns/libdns)
2+
========================
3+
4+
[![Go Reference](https://pkg.go.dev/badge/test.svg)](https://pkg.go.dev/github.com/libdns/he)
5+
6+
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for Hurricane Electric,
7+
allowing you to manage DNS records.
8+
9+
This package uses the dynamic DNS feature of Hurricane Electric Hosted DNS.
10+
11+
Configuration
12+
=============
13+
14+
To configure a dynamic DNS record in HE, login to the [HE DNS portal](https://dns.he.net/)
15+
and select the domain to configure the record under.
16+
17+
Add a new A/AAAA/TXT record and select the "Enable entry for dynamic dns" option.
18+
19+
Once the record has been created click the Generate a DDNS key 🗘 button and set a key.
20+
21+
Example
22+
=======
23+
24+
```go
25+
package main
26+
27+
import (
28+
"context"
29+
"fmt"
30+
"os"
31+
32+
"github.com/libdns/he"
33+
"github.com/libdns/libdns"
34+
)
35+
36+
func main() {
37+
key := os.Getenv("LIBDNS_HE_KEY")
38+
if key == "" {
39+
fmt.Println("LIBDNS_HE_KEY not set")
40+
return
41+
}
42+
43+
zone := os.Getenv("LIBDNS_HE_ZONE")
44+
if zone == "" {
45+
fmt.Println("LIBDNS_HE_ZONE not set")
46+
return
47+
}
48+
49+
p := &he.Provider{
50+
APIKey: key,
51+
}
52+
53+
records := []libdns.Record{
54+
{
55+
Type: "A",
56+
Name: "test",
57+
Value: "198.51.100.1",
58+
},
59+
{
60+
Type: "AAAA",
61+
Name: "test",
62+
Value: "2001:0db8::1",
63+
},
64+
{
65+
Type: "TXT",
66+
Name: "test",
67+
Value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
68+
},
69+
}
70+
71+
ctx := context.Background()
72+
_, err := p.SetRecords(ctx, zone, records)
73+
if err != nil {
74+
fmt.Printf("Error: %v", err)
75+
return
76+
}
77+
}
78+
```

0 commit comments

Comments
 (0)