summaryrefslogtreecommitdiff
path: root/source/source.go
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2026-08-20 22:05:41 +0200
committerMel <mel@rnrd.eu>2026-08-20 22:05:41 +0200
commitf896a9775c34c0e095273c193806ca245dfae940 (patch)
treec07736e8243d22891f9a549d0b712a7d0b074482 /source/source.go
parenta81cf3b385e45587a6be51f7958f9042975fc0c6 (diff)
downloadddnnss-f896a9775c34c0e095273c193806ca245dfae940.tar.zst
ddnnss-f896a9775c34c0e095273c193806ca245dfae940.zip
Add IPv4/IPv6 source from 'icanhazip.com'
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'source/source.go')
-rw-r--r--source/source.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/source.go b/source/source.go
index ffa380a..571abda 100644
--- a/source/source.go
+++ b/source/source.go
@@ -13,10 +13,10 @@ import (
type Kind string
const (
- // only the simple generic sources for now!
- KindStatic Kind = "static"
- KindURL Kind = "url"
- KindFile Kind = "file"
+ KindStatic Kind = "static"
+ KindURL Kind = "url"
+ KindFile Kind = "file"
+ KindICanHazIp Kind = "icanhazip"
)
type Family string
@@ -49,6 +49,11 @@ func New(log *slog.Logger, name string, cfg Config) (Source, error) {
),
)
+ if cfg.Kind == KindICanHazIp {
+ return newICanHazIp(log)
+ }
+
+ // all sources below need an explicit family
if cfg.Family != IPv4 && cfg.Family != IPv6 {
return nil, fmt.Errorf("%s source needs family set to ipv4 or ipv6", cfg.Kind)
}