Skip to content

Commit 1eac90e

Browse files
authored
Merge pull request #72 from ipinfo/silvano/eng-610-update-readme-documentation-for-ipinfogo
Add documentation for Core and Plus bundles and resproxy
2 parents 43e1af6 + 2a8c3f5 commit 1eac90e

File tree

1 file changed

+106
-20
lines changed

1 file changed

+106
-20
lines changed

README.md

Lines changed: 106 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ This is the official Go client library for the [IPinfo.io](https://ipinfo.io) IP
1212

1313
Check all the data we have for your IP address [here](https://ipinfo.io/what-is-my-ip).
1414

15-
1615
- [Getting Started](#getting-started)
17-
- [Installation](#installation)
18-
- [Quickstart](#quickstart)
16+
- [Installation](#installation)
17+
- [Quickstart](#quickstart)
1918
- [Authentication](#authentication)
2019
- [Internationalization](#internationalization)
21-
- [Country Name](#country-name)
22-
- [European Union (EU) Country](#european-union-eu-country)
23-
- [Country Flag](#country-flag)
24-
- [Country Currency](#country-currency)
25-
- [Continent](#continent)
20+
- [Country Name](#country-name)
21+
- [European Union (EU) Country](#european-union-eu-country)
22+
- [Country Flag](#country-flag)
23+
- [Country Currency](#country-currency)
24+
- [Continent](#continent)
2625
- [Map IP Address](#map-ip-address)
2726
- [Summarize IP Address](#summarize-ip-address)
2827
- [Caching](#caching)
@@ -32,7 +31,6 @@ Check all the data we have for your IP address [here](https://ipinfo.io/what-is-
3231

3332
# Getting Started
3433

35-
3634
You'll need an IPinfo API access token, which you can get by signing up for a free account at [https://ipinfo.io/signup](https://ipinfo.io/signup).
3735

3836
The free plan is limited to 50,000 requests per month, and doesn't include some of the data fields such as IP type and company data. To enable all the data fields and additional request volumes see [https://ipinfo.io/pricing](https://ipinfo.io/pricing)
@@ -51,7 +49,6 @@ go get github.com/ipinfo/go/v2/ipinfo
5149

5250
Basic usage of the package.
5351

54-
5552
```go
5653
package main
5754

@@ -64,7 +61,7 @@ import (
6461

6562
func main() {
6663
const token = "YOUR_TOKEN"
67-
64+
6865
// params: httpClient, cache, token. `http.DefaultClient` and no cache will be used in case of `nil`.
6966
client := ipinfo.NewClient(nil, nil, token)
7067

@@ -96,7 +93,7 @@ client := ipinfo.NewClient(nil, nil, token)
9693

9794
## Country Name
9895

99-
`info.Country` returns the ISO 3166 country code and `info.CountryName` returns the entire conuntry name:
96+
`info.Country` returns the ISO 3166 country code and `info.CountryName` returns the entire conuntry name:
10097

10198
```go
10299
fmt.Println(info.Country)
@@ -120,7 +117,7 @@ Get country flag as an emoji and its Unicode value with `info.CountryFlag.Emoji`
120117

121118
```go
122119
fmt.Println(info.CountryFlag.Emoji)
123-
// Output: 🇳🇿
120+
// Output: 🇳🇿
124121
fmt.Println(info.CountryFlag.Unicode)
125122
// Output: "U+1F1F3 U+1F1FF"
126123
```
@@ -140,7 +137,7 @@ Get country's currency code and its symbol with `info.CountryCurrency.Code` and
140137

141138
```go
142139
fmt.Println(info.CountryCurrency.Code)
143-
// Output: USD
140+
// Output: USD
144141
fmt.Println(info.CountryCurrency.Symbol)
145142
// Output: $
146143
```
@@ -151,7 +148,7 @@ Get the IP's continent code and its name with `info.Continent.Code` and `info.Co
151148

152149
```go
153150
fmt.Println(info.Continent.Code)
154-
// Output: NA
151+
// Output: NA
155152
fmt.Println(info.Continent.Name)
156153
// Output: North America
157154
```
@@ -205,7 +202,7 @@ See the output example map: https://ipinfo.io/tools/map/f27c7d40-3ff0-4ac2-878f-
205202

206203
# Summarize IP Address
207204

208-
Summarize IP addresses with `GetIPSummary` and output a report.
205+
Summarize IP addresses with `GetIPSummary` and output a report.
209206

210207
```go
211208
package main
@@ -247,7 +244,6 @@ You can do batch lookups or bulk lookups quite easily as well. The inputs suppor
247244
- IP addresses. IPV4 and IPV6 both
248245
- ASN
249246
- Specific field endpoint of an IP address e.g. `8.8.8.8/country`
250-
251247

252248
```go
253249
package main
@@ -317,13 +313,13 @@ import (
317313

318314
func main() {
319315
const token = "YOUR_TOKEN"
320-
316+
321317
// Create a Lite client
322318
client := ipinfo.NewLiteClient(nil, nil, token)
323-
319+
324320
// Or use the package-level client
325321
ipinfo.SetLiteToken(token)
326-
322+
327323
info, err := ipinfo.GetIPInfoLite(net.ParseIP("8.8.8.8"))
328324
if err != nil {
329325
log.Fatal(err)
@@ -335,6 +331,96 @@ func main() {
335331
}
336332
```
337333

334+
### Core API
335+
336+
The library also supports the [Core API](https://ipinfo.io/developers/data-types#core-data), which provides city-level geolocation with nested geo and AS objects. Authentication with your token is required.
337+
338+
```go
339+
package main
340+
341+
import (
342+
"fmt"
343+
"log"
344+
"net"
345+
"github.com/ipinfo/go/v2/ipinfo"
346+
)
347+
348+
func main() {
349+
const token = "YOUR_TOKEN"
350+
client := ipinfo.NewCoreClient(nil, nil, token)
351+
352+
info, err := client.GetIPInfo(net.ParseIP("8.8.8.8"))
353+
if err != nil {
354+
log.Fatal(err)
355+
}
356+
357+
fmt.Println(info.IP) // 8.8.8.8
358+
fmt.Println(info.Geo.City) // Mountain View
359+
fmt.Println(info.Geo.Country) // United States
360+
fmt.Println(info.AS.ASN) // AS15169
361+
fmt.Println(info.AS.Name) // Google LLC
362+
}
363+
```
364+
365+
### Plus API
366+
367+
The library also supports the [Plus API](https://ipinfo.io/developers/data-types#plus-data), which provides enhanced data including mobile carrier info and privacy detection. Authentication with your token is required.
368+
369+
```go
370+
package main
371+
372+
import (
373+
"fmt"
374+
"log"
375+
"net"
376+
"github.com/ipinfo/go/v2/ipinfo"
377+
)
378+
379+
func main() {
380+
const token = "YOUR_TOKEN"
381+
client := ipinfo.NewPlusClient(nil, nil, token)
382+
383+
info, err := client.GetIPInfo(net.ParseIP("8.8.8.8"))
384+
if err != nil {
385+
log.Fatal(err)
386+
}
387+
388+
fmt.Println(info.IP) // 8.8.8.8
389+
fmt.Println(info.Geo.City) // Mountain View
390+
fmt.Println(info.Mobile) // mobile carrier info
391+
fmt.Println(info.Anonymous.Proxy) // false
392+
}
393+
```
394+
395+
### Residential Proxy API
396+
397+
The library also supports the [Residential Proxy API](https://ipinfo.io/developers/residential-proxy-api), which allows you to check if an IP address is a residential proxy. Authentication with your token is required.
398+
399+
```go
400+
package main
401+
402+
import (
403+
"fmt"
404+
"log"
405+
"github.com/ipinfo/go/v2/ipinfo"
406+
)
407+
408+
func main() {
409+
const token = "YOUR_TOKEN"
410+
client := ipinfo.NewClient(nil, nil, token)
411+
412+
resproxy, err := client.GetResproxy("175.107.211.204")
413+
if err != nil {
414+
log.Fatal(err)
415+
}
416+
417+
fmt.Println(resproxy.IP) // 175.107.211.204
418+
fmt.Println(resproxy.LastSeen) // 2025-01-20
419+
fmt.Println(resproxy.PercentDaysSeen) // 0.85
420+
fmt.Println(resproxy.Service) // Bright Data
421+
}
422+
```
423+
338424
# Other Libraries
339425

340426
There are official [IPinfo client libraries](https://ipinfo.io/developers/libraries) available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. There are also many third-party libraries and integrations available for our API.

0 commit comments

Comments
 (0)