geoip

package module
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 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 added in v0.3.5

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

ConfigMaxMind MaxMind database config

func (*ConfigMaxMind) Default added in v0.3.5

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