1
0
Fork 0
mirror of https://gitlab.com/pnx-tools/dns-updater.git synced 2026-06-16 05:54:56 +02:00
dns-updater/ip/resolver/manager.go

53 lines
923 B
Go

package resolver
import (
"net/http"
"dnsupdater/ip/resolver/basic_http"
)
var services []Service
func Provide(service Service) {
services = append(services, service)
}
func Get(name string) Service {
for _, service := range services {
if service.Name() == name {
return service
}
}
return nil
}
func init() {
Provide(&basic_http.Service{
ServiceName: "jsonip",
Url: "https://jsonip.com",
Decoder: JsonipDecoder,
})
Provide(&basic_http.Service{
ServiceName: "ifconfig.me",
Url: "https://ifconfig.me/ip",
})
Provide(&basic_http.Service{
ServiceName: "ip.me",
Url: "https://ip.me",
Headers: http.Header{
"User-Agent": []string{"curl"},
},
})
Provide(&basic_http.Service{
ServiceName: "ipecho",
Url: "http://ipecho.net/plain",
})
Provide(&basic_http.Service{
ServiceName: "icanhazip",
Url: "https://icanhazip.com",
})
}