maxminddb_golang_example

package module
v0.0.0-...-973a091 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 2 Imported by: 0

README

Приклад використання MaxMind в Go

https://dou.ua/forums/topic/35195/

Support Ukraine 🇺🇦

Structure

tree . -h
├── [4.0K]  GeoLite2-City_20230721
│   ├── [  55]  COPYRIGHT.txt
│   ├── [ 68M]  GeoLite2-City.mmdb
│   ├── [ 398]  LICENSE.txt
│   └── [ 116]  README.txt
├── [4.0K]  GeoLite2-Country_20230721
│   ├── [  55]  COPYRIGHT.txt
│   ├── [5.8M]  GeoLite2-Country.mmdb
│   └── [ 398]  LICENSE.txt
├── [ 33M]  GeoLite2-City_20230721.tar.gz
├── [3.0M]  GeoLite2-Country_20230721.tar.gz
├── [ 253]  go.mod
├── [ 881]  go.sum
├── [1.0K]  LICENSE
├── [ 155]  main_test.go
├── [ 525]  Makefile
└── [  91]  README.md

Testing

# make bench
go test ./... -v -bench=. -benchmem -benchtime=1000000x -count=10 > bench.txt
benchstat bench.txt
goos: linux
goarch: amd64
pkg: github.com/doutivity/maxminddb-golang-example
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
BenchmarkLookupTurkey
BenchmarkLookupTurkey-12    	 1000000	      2370 ns/op	      34 B/op	       3 allocs/op
PASS
ok  	github.com/doutivity/maxminddb-golang-example	2.374s
name                            time/op
GeoLite2CountryLookupTurkey-12  2.75µs ± 4%
GeoLite2CityLookupTurkey-12     3.23µs ± 8%

name                            alloc/op
GeoLite2CountryLookupTurkey-12   34.0B ± 0%
GeoLite2CityLookupTurkey-12      34.0B ± 0%

name                            allocs/op
GeoLite2CountryLookupTurkey-12    3.00 ± 0%
GeoLite2CityLookupTurkey-12       3.00 ± 0%

Packages

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPV4RoundRobin

type IPV4RoundRobin struct {
	// contains filtered or unexported fields
}

func NewIPV4RoundRobin

func NewIPV4RoundRobin(startIP net.IP, endIP net.IP) *IPV4RoundRobin

func (*IPV4RoundRobin) Next

func (rr *IPV4RoundRobin) Next() net.IP

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL