geoip

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudflareMiddleware added in v0.9.0

func CloudflareMiddleware() web.Middleware

CloudflareMiddleware determine geo-ip information when proxying through Cloudflare

func GetClientIP

func GetClientIP(c ctx) net.IP

func GetCountryName

func GetCountryName(c ctx) *string

func GetProxyIPs

func GetProxyIPs(c ctx) []net.IP

func MaxMindMiddleware added in v0.9.0

func MaxMindMiddleware(resolver geoIP) web.Middleware

MaxMindMiddleware determine geo-ip information through local MaxMind database

func SetClientIP

func SetClientIP(ctx context.Context, value net.IP) context.Context

func SetCountryName

func SetCountryName(ctx context.Context, value string) context.Context

func SetProxyIPs

func SetProxyIPs(ctx context.Context, value []net.IP) context.Context

func WithMaxMindGeoIP

func WithMaxMindGeoIP() plugins.Plugin

WithMaxMindGeoIP information resolver through local MaxMind database

Types

type GeoIP

type GeoIP interface {
	Country(ip net.IP) (string, error)
}

GeoIP geo-ip information definition interface

type MaxMindConfig

type MaxMindConfig struct {
	DB string `yaml:"maxminddb"`
}

MaxMindConfig MaxMind database config

func (*MaxMindConfig) Default

func (v *MaxMindConfig) Default()

Jump to

Keyboard shortcuts

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