Skip to content

Commit

Permalink
fix(publicip/http): remove google provider which no longer works
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Sep 17, 2024
1 parent 1303551 commit 623cb53
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ You can otherwise customize it with the following:
- `ipify` using [https://api64.ipify.org](https://api64.ipify.org)
- `ifconfig` using [https://ifconfig.io/ip](https://ifconfig.io/ip)
- `ipinfo` using [https://ipinfo.io/ip](https://ipinfo.io/ip)
- `google` using [https://domains.google.com/checkip](https://domains.google.com/checkip)
- `spdyn` using [https://checkip.spdyn.de](https://checkip.spdyn.de/)
- `ipleak` using [https://ipleak.net/json](https://ipleak.net/json)
- `icanhazip` using [https://icanhazip.com](https://icanhazip.com)
Expand Down
4 changes: 2 additions & 2 deletions cmd/ddns-updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func _main(ctx context.Context, reader *reader.Reader, args []string, logger log
}

func printSplash(buildInfo models.BuildInformation) {
announcementExp, err := time.Parse(time.RFC3339, "2023-07-15T00:00:00Z")
announcementExp, err := time.Parse(time.RFC3339, "2024-10-15T00:00:00Z")
if err != nil {
panic(err)
}
Expand All @@ -273,7 +273,7 @@ func printSplash(buildInfo models.BuildInformation) {
Version: buildInfo.Version,
Commit: buildInfo.Commit,
Created: buildInfo.Created,
Announcement: "Public IP dns provider GOOGLE, see https://github.com/qdm12/ddns-updater/issues/492",
Announcement: "Public IP http provider GOOGLE is no longer working",
AnnounceExp: announcementExp,
// Sponsor information
PaypalUser: "qmcgaw",
Expand Down
7 changes: 6 additions & 1 deletion internal/config/pubip.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ func (p *PubIP) read(r *reader.Reader, warner Warner) (err error) {
copy(httpIPProvidersTemp, p.HTTPIPProviders)
p.HTTPIPProviders = make([]string, 0, len(p.HTTPIPProviders))
for _, provider := range httpIPProvidersTemp {
if provider != "opendns" {
switch provider {
case "opendns": // no longer available, for a long time
case "google": // found no longer working on 2024.09.17
warner.Warnf("http provider google will be ignored " +
"since it is no longer supported by Google")
default:
p.HTTPIPProviders = append(p.HTTPIPProviders, provider)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/publicip/dns/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func Test_SetProviders(t *testing.T) {
expectedSettings settings
err error
}{
"Google": {
"OpenDNS": {
initialSettings: settings{
providers: []Provider{Cloudflare},
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/publicip/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Test_New(t *testing.T) {
timeout: 5 * time.Second,
ip4or6: &urlsRing{
banned: map[int]string{},
urls: []string{"https://domains.google.com/checkip"},
urls: []string{"https://api64.ipify.org"},
},
ip4: &urlsRing{
banned: map[int]string{},
Expand All @@ -39,7 +39,7 @@ func Test_New(t *testing.T) {
},
"with options": {
options: []Option{
SetProvidersIP(Google),
SetProvidersIP(Ifconfig),
SetProvidersIP4(Ipify),
SetProvidersIP6(Ipify),
SetTimeout(time.Second),
Expand All @@ -49,7 +49,7 @@ func Test_New(t *testing.T) {
timeout: time.Second,
ip4or6: &urlsRing{
banned: map[int]string{},
urls: []string{"https://domains.google.com/checkip"},
urls: []string{"https://ifconfig.io/ip"},
},
ip4: &urlsRing{
banned: map[int]string{},
Expand Down
2 changes: 1 addition & 1 deletion pkg/publicip/http/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func Test_integration(t *testing.T) {

client := &http.Client{}

fetcher, err := New(client, SetProvidersIP(Google))
fetcher, err := New(client, SetProvidersIP(Ipify))
require.NoError(t, err)

ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletion pkg/publicip/http/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type settings struct {
func newDefaultSettings() settings {
const defaultTimeout = 5 * time.Second
return settings{
providersIP: []Provider{Google},
providersIP: []Provider{Ipify},
providersIP4: []Provider{Ipify},
providersIP6: []Provider{Ipify},
timeout: defaultTimeout,
Expand Down
6 changes: 3 additions & 3 deletions pkg/publicip/http/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ func Test_SetProvidersIP(t *testing.T) {
expectedSettings settings
err error
}{
"Google": {
"Ipify": {
initialSettings: settings{
providersIP: []Provider{Ifconfig},
},
providers: []Provider{Google},
providers: []Provider{Ipify},
expectedSettings: settings{
providersIP: []Provider{Google},
providersIP: []Provider{Ipify},
},
},
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/publicip/http/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
type Provider string

const (
Google Provider = "google"
Ifconfig Provider = "ifconfig"
Ipify Provider = "ipify"
Ipinfo Provider = "ipinfo"
Expand All @@ -28,7 +27,6 @@ const (

func ListProviders() []Provider {
return []Provider{
Google,
Ifconfig,
Ipify,
Ipinfo,
Expand Down Expand Up @@ -118,8 +116,6 @@ func (provider Provider) url(version ipversion.IPVersion) (url string, ok bool)
switch provider {
case Ipify:
url = "https://api64.ipify.org"
case Google:
url = "https://domains.google.com/checkip"
case Ifconfig:
url = "https://ifconfig.io/ip"
case Ipinfo:
Expand Down
8 changes: 4 additions & 4 deletions pkg/publicip/http/providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test_ListProvidersForVersion(t *testing.T) {
}{
"ip4or6": {
version: ipversion.IP4or6,
providers: []Provider{Google, Ifconfig, Ipify, Ipinfo, Spdyn, Ipleak,
providers: []Provider{Ifconfig, Ipify, Ipinfo, Spdyn, Ipleak,
Icanhazip, Ident, Nnev, Wtfismyip, Seeip, Changeip},
},
"ip4": {
Expand Down Expand Up @@ -51,17 +51,17 @@ func Test_ValidateProvider(t *testing.T) {
err error
}{
"valid": {
provider: Google,
provider: Ifconfig,
version: ipversion.IP4or6,
},
"custom url": {
provider: Provider("url:https://ip.com"),
version: ipversion.IP4or6,
},
"invalid for ip version": {
provider: Google,
provider: Ifconfig,
version: ipversion.IP4,
err: errors.New(`provider does not support IP version: "google" for version ipv4`),
err: errors.New(`provider does not support IP version: "ifconfig" for version ipv4`),
},
"unknown": {
provider: Provider("unknown"),
Expand Down

0 comments on commit 623cb53

Please sign in to comment.