geoip

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudflareMiddleware

func CloudflareMiddleware() web.Middleware

CloudflareMiddleware determine geo-ip information when proxying through Cloudflare

func GetClientIP

func GetClientIP(ctx context.Context) net.IP

func GetCountryName

func GetCountryName(ctx context.Context) string

func GetProxyIPs

func GetProxyIPs(ctx context.Context) []net.IP

func MaxMindMiddleware

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 ConfigMaxMind

type ConfigMaxMind struct {
	GeoIP struct {
		MaxMindDB string `yaml:"maxminddb"`
	} `yaml:"geoip"`
}

func (*ConfigMaxMind) Default

func (v *ConfigMaxMind) Default()

type GeoIP

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

GeoIP geo-ip information definition interface

Jump to

Keyboard shortcuts

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