Skip to content

Commit

Permalink
feat: support ddns enable option
Browse files Browse the repository at this point in the history
  • Loading branch information
yl2356 committed Mar 31, 2022
1 parent 20dbe5a commit 0b73ddb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
25 changes: 19 additions & 6 deletions configs/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@
accesskeyid:
accesskeysecret:
domain:
updateintervalmin: 5
updateintervalmin: 60
ddnss:
- type: "A"
rr: "x.home"
- enable: false
type: "A"
rr: "template.home"
interface: "ens18"
prefix: "192.168"



- enable: false
type: "A"
rr: "*.template.home"
interface: "ens18"
prefix: "192.168"
- enable: false
type: "AAAA"
rr: "template6.home"
interface: "ens18"
prefix: "240e"
- enable: false
type: "AAAA"
rr: "*.template6.home"
interface: "ens18"
prefix: "240e"
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Config struct {
Domain string
UpdateIntervalMin int
DDNSs []struct {
Enable bool
Type string
RR string
Interface string
Expand Down
3 changes: 3 additions & 0 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func UpdateDns() {
}

for _, ddns := range config.Cfg.DDNSs {
if !ddns.Enable {
continue
}
logFields := []zap.Field{zap.Reflect("ddns", ddns)}

ip, err := utils.GetIpWithPrefix(ddns.Interface, ddns.Prefix)
Expand Down

0 comments on commit 0b73ddb

Please sign in to comment.