fix unix line endings
This commit is contained in:
parent
b53e0bb9c7
commit
c955b3ee3c
24 changed files with 1044 additions and 1044 deletions
|
|
@ -1,70 +1,70 @@
|
|||
package resolver
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"dnsupdater/ip/resolver/decoder"
|
||||
httpres "dnsupdater/ip/resolver/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(&httpres.Service{
|
||||
ServiceName: "jsonip",
|
||||
Url: "https://jsonip.com",
|
||||
Decoder: decoder.Jsonip,
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ifconfig.me",
|
||||
Url: "https://ifconfig.me/ip",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ip.me",
|
||||
Url: "https://ip.me",
|
||||
Headers: http.Header{
|
||||
"User-Agent": []string{"curl"},
|
||||
},
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ipecho",
|
||||
Url: "http://ipecho.net/plain",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "icanhazip",
|
||||
Url: "https://icanhazip.com",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ipify",
|
||||
Url: "https://api.ipify.org",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "myip",
|
||||
Url: "https://api.myip.com",
|
||||
Decoder: decoder.MyIP,
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "my-ip",
|
||||
Url: "https://api.my-ip.io/v2/ip.txt",
|
||||
})
|
||||
}
|
||||
package resolver
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"dnsupdater/ip/resolver/decoder"
|
||||
httpres "dnsupdater/ip/resolver/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(&httpres.Service{
|
||||
ServiceName: "jsonip",
|
||||
Url: "https://jsonip.com",
|
||||
Decoder: decoder.Jsonip,
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ifconfig.me",
|
||||
Url: "https://ifconfig.me/ip",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ip.me",
|
||||
Url: "https://ip.me",
|
||||
Headers: http.Header{
|
||||
"User-Agent": []string{"curl"},
|
||||
},
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ipecho",
|
||||
Url: "http://ipecho.net/plain",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "icanhazip",
|
||||
Url: "https://icanhazip.com",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "ipify",
|
||||
Url: "https://api.ipify.org",
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "myip",
|
||||
Url: "https://api.myip.com",
|
||||
Decoder: decoder.MyIP,
|
||||
})
|
||||
|
||||
Provide(&httpres.Service{
|
||||
ServiceName: "my-ip",
|
||||
Url: "https://api.my-ip.io/v2/ip.txt",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue