-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit be4310b
Showing
9 changed files
with
698 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "go.mod" | ||
check-latest: true | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
codechecks: | ||
name: Code checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "go.mod" | ||
check-latest: true | ||
|
||
- name: Lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
args: --out-format=github-actions,line-number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Brad Cowie | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
Hurricane Electric for [`libdns`](https://github.com/libdns/libdns) | ||
======================== | ||
|
||
[![Go Reference](https://pkg.go.dev/badge/test.svg)](https://pkg.go.dev/github.com/libdns/he) | ||
|
||
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for Hurricane Electric, | ||
allowing you to manage DNS records. | ||
|
||
This package uses the dynamic DNS feature of Hurricane Electric Hosted DNS. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure a dynamic DNS record in HE, login to the [HE DNS portal](https://dns.he.net/) | ||
and select the domain to configure the record under. | ||
|
||
Add a new A/AAAA/TXT record and select the "Enable entry for dynamic dns" option. | ||
|
||
Once the record has been created click the Generate a DDNS key 🗘 button and set a key. | ||
|
||
Example | ||
======= | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/libdns/he" | ||
"github.com/libdns/libdns" | ||
) | ||
|
||
func main() { | ||
key := os.Getenv("LIBDNS_HE_KEY") | ||
if key == "" { | ||
fmt.Println("LIBDNS_HE_KEY not set") | ||
return | ||
} | ||
|
||
zone := os.Getenv("LIBDNS_HE_ZONE") | ||
if zone == "" { | ||
fmt.Println("LIBDNS_HE_ZONE not set") | ||
return | ||
} | ||
|
||
p := &he.Provider{ | ||
APIKey: key, | ||
} | ||
|
||
records := []libdns.Record{ | ||
{ | ||
Type: "A", | ||
Name: "test", | ||
Value: "198.51.100.1", | ||
}, | ||
{ | ||
Type: "AAAA", | ||
Name: "test", | ||
Value: "2001:0db8::1", | ||
}, | ||
{ | ||
Type: "TXT", | ||
Name: "test", | ||
Value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", | ||
}, | ||
} | ||
|
||
ctx := context.Background() | ||
_, err := p.SetRecords(ctx, zone, records) | ||
if err != nil { | ||
fmt.Printf("Error: %v", err) | ||
return | ||
} | ||
} | ||
``` |
Oops, something went wrong.