Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phuslu/iploc
Fastest IP To Country Library
https://github.com/phuslu/iploc
geoip geolocation
Last synced: 28 days ago
JSON representation
Fastest IP To Country Library
- Host: GitHub
- URL: https://github.com/phuslu/iploc
- Owner: phuslu
- License: mit
- Created: 2018-06-23T05:36:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-31T11:34:44.000Z (9 months ago)
- Last Synced: 2024-03-31T12:34:55.997Z (9 months ago)
- Topics: geoip, geolocation
- Language: Go
- Homepage:
- Size: 8.56 MB
- Stars: 288
- Watchers: 12
- Forks: 22
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - phuslu/iploc - Fastest IP To Country Library (Go)
README
# iploc - fastest ip country library
[![godoc][godoc-img]][godoc] [![release][release-img]][release] [![goreport][goreport-img]][goreport]
### Getting Started
try on https://play.golang.org/p/T_7jfSr0cE1
```go
package mainimport (
"fmt"
"net/netip"
"github.com/phuslu/iploc"
)func main() {
fmt.Printf("%s", iploc.IPCountry(netip.MustParseAddr("1.1.1.1"))
}// Output: US
```### Benchmarks
```
goos: windows
goarch: amd64
pkg: github.com/phuslu/iploc
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
BenchmarkIPCountryForIPv4
BenchmarkIPCountryForIPv4-8 80750439 13.57 ns/op 0 B/op 0 allocs/op
BenchmarkIPCountryForIPv6
BenchmarkIPCountryForIPv6-8 57166812 20.44 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/phuslu/iploc 2.360s
```### Acknowledgment
This site or product includes IP2Location LITE data available from http://www.ip2location.com.### How often are the inlined ip data updated?
Following IP2Location Lite Database, usually **monthly**.[godoc-img]: http://img.shields.io/badge/godoc-reference-blue.svg
[godoc]: https://godoc.org/github.com/phuslu/iploc
[release-img]: https://img.shields.io/github/v/tag/phuslu/iploc?label=release
[release]: https://github.com/phuslu/iploc/releases
[goreport-img]: https://goreportcard.com/badge/github.com/phuslu/iploc
[goreport]: https://goreportcard.com/report/github.com/phuslu/iploc
[coverage-img]: http://gocover.io/_badge/github.com/phuslu/iploc
[coverage]: https://gocover.io/github.com/phuslu/iploc