feat(publicip/http): add seeip.org for all ip versions

This commit is contained in:
Quentin McGaw
2024-02-13 10:35:59 +00:00
parent 5e0e3f4702
commit 346f4aa7f7
3 changed files with 15 additions and 4 deletions

View File

@@ -281,6 +281,7 @@ You can otherwise customize it with the following:
- `ident` using [https://ident.me](https://ident.me)
- `nnev` using [https://ip.nnev.de](https://ip.nnev.de)
- `wtfismyip` using [https://wtfismyip.com/text](https://wtfismyip.com/text)
- `seeip` using [https://api.seeip.org](https://api.seeip.org)
- You can also specify an HTTPS URL such as `https://ipinfo.io/ip`
- `PUBLICIPV4_HTTP_PROVIDERS` gets your public IPv4 address only. It can be one or more of the following:
- `ipleak` using [https://ipv4.ipleak.net/json](https://ipv4.ipleak.net/json)
@@ -289,6 +290,7 @@ You can otherwise customize it with the following:
- `ident` using [https://v4.ident.me](https://v4.ident.me)
- `nnev` using [https://ip4.nnev.de](https://ip4.nnev.de)
- `wtfismyip` using [https://ipv4.wtfismyip.com/text](https://ipv4.wtfismyip.com/text)
- `seeip` using [https://ipv4.seeip.org](https://ipv4.seeip.org)
- You can also specify an HTTPS URL such as `https://ipinfo.io/ip`
- `PUBLICIPV6_HTTP_PROVIDERS` gets your public IPv6 address only. It can be one or more of the following:
- `ipleak` using [https://ipv6.ipleak.net/json](https://ipv6.ipleak.net/json)
@@ -297,6 +299,7 @@ You can otherwise customize it with the following:
- `ident` using [https://v6.ident.me](https://v6.ident.me)
- `nnev` using [https://ip6.nnev.de](https://ip6.nnev.de)
- `wtfismyip` using [https://ipv6.wtfismyip.com/text](https://ipv6.wtfismyip.com/text)
- `seeip` using [https://ipv6.seeip.org](https://ipv6.seeip.org)
- You can also specify an HTTPS URL such as `https://ipinfo.io/ip`
- `PUBLICIP_DNS_PROVIDERS` gets your public IPv4 address only or IPv6 address only or one of them (see #136). It can be one or more of the following:
- `cloudflare`

View File

@@ -22,6 +22,7 @@ const (
Ident Provider = "ident"
Nnev Provider = "nnev"
Wtfismyip Provider = "wtfismyip"
Seeip Provider = "seeip"
)
func ListProviders() []Provider {
@@ -36,6 +37,7 @@ func ListProviders() []Provider {
Ident,
Nnev,
Wtfismyip,
Seeip,
}
}
@@ -72,7 +74,7 @@ func ValidateProvider(provider Provider, version ipversion.IPVersion) error {
return fmt.Errorf("%w: %s", ErrUnknownProvider, provider)
}
func (provider Provider) url(version ipversion.IPVersion) (url string, ok bool) {
func (provider Provider) url(version ipversion.IPVersion) (url string, ok bool) { //nolint:gocyclo
switch version {
case ipversion.IP4:
switch provider { //nolint:exhaustive
@@ -88,6 +90,8 @@ func (provider Provider) url(version ipversion.IPVersion) (url string, ok bool)
url = "https://ip4.nnev.de"
case Wtfismyip:
url = "https://ipv4.wtfismyip.com/text"
case Seeip:
url = "https://ipv4.seeip.org"
}
case ipversion.IP6:
@@ -104,6 +108,8 @@ func (provider Provider) url(version ipversion.IPVersion) (url string, ok bool)
url = "https://ip6.nnev.de"
case Wtfismyip:
url = "https://ipv6.wtfismyip.com/text"
case Seeip:
url = "https://ipv6.seeip.org"
}
case ipversion.IP4or6:
@@ -128,6 +134,8 @@ func (provider Provider) url(version ipversion.IPVersion) (url string, ok bool)
url = "https://ip.nnev.de"
case Wtfismyip:
url = "https://wtfismyip.com/text"
case Seeip:
url = "https://api.seeip.org"
}
}

View File

@@ -20,15 +20,15 @@ func Test_ListProvidersForVersion(t *testing.T) {
"ip4or6": {
version: ipversion.IP4or6,
providers: []Provider{Google, Ifconfig, Ipify, Ipinfo, Spdyn, Ipleak,
Icanhazip, Ident, Nnev, Wtfismyip},
Icanhazip, Ident, Nnev, Wtfismyip, Seeip},
},
"ip4": {
version: ipversion.IP4,
providers: []Provider{Ipify, Ipleak, Icanhazip, Ident, Nnev, Wtfismyip},
providers: []Provider{Ipify, Ipleak, Icanhazip, Ident, Nnev, Wtfismyip, Seeip},
},
"ip6": {
version: ipversion.IP6,
providers: []Provider{Ipify, Ipleak, Icanhazip, Ident, Nnev, Wtfismyip},
providers: []Provider{Ipify, Ipleak, Icanhazip, Ident, Nnev, Wtfismyip, Seeip},
},
}