mirror of
https://github.com/taigrr/godns
synced 2025-01-18 04:03:25 -08:00
34 lines
829 B
Go
34 lines
829 B
Go
package handler
|
|
|
|
import (
|
|
"github.com/TimothyYe/godns"
|
|
"github.com/TimothyYe/godns/handler/alidns"
|
|
"github.com/TimothyYe/godns/handler/cloudflare"
|
|
"github.com/TimothyYe/godns/handler/dnspod"
|
|
"github.com/TimothyYe/godns/handler/he"
|
|
)
|
|
|
|
// IHandler is the interface for all DNS handlers
|
|
type IHandler interface {
|
|
SetConfiguration(*godns.Settings)
|
|
DomainLoop(domain *godns.Domain, panicChan chan<- godns.Domain)
|
|
}
|
|
|
|
// CreateHandler creates DNS handler by different providers
|
|
func CreateHandler(provider string) IHandler {
|
|
var handler IHandler
|
|
|
|
switch provider {
|
|
case godns.CLOUDFLARE:
|
|
handler = IHandler(&cloudflare.Handler{})
|
|
case godns.DNSPOD:
|
|
handler = IHandler(&dnspod.Handler{})
|
|
case godns.HE:
|
|
handler = IHandler(&he.Handler{})
|
|
case godns.ALIDNS:
|
|
handler = IHandler(&alidns.Handler{})
|
|
}
|
|
|
|
return handler
|
|
}
|