GeoIpFilter

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGeoIPFilter

func InitGeoIPFilter(h interface{}, cfgData map[string]interface{}, callNo int) (err error)

Types

type GeoIPFilterType

type GeoIPFilterType struct {
	Next          http.Handler
	Paths         []string
	Action        string // reject, allow
	CountryCodes  []string
	PageIfBlocked string
	DBFileName    string
	LineNo        int
	// contains filtered or unexported fields
}

func NewGeoIPFilterServer

func NewGeoIPFilterServer(n http.Handler, p []string, dbf string, act string, codes []string, fail_page_url string) *GeoIPFilterType

func (*GeoIPFilterType) InitializeWithConfigData

func (hdlr *GeoIPFilterType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*GeoIPFilterType) MatchCountryCode

func (hdlr *GeoIPFilterType) MatchCountryCode(isocode string) bool

func (*GeoIPFilterType) PreValidate

func (hdlr *GeoIPFilterType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*GeoIPFilterType) ServeHTTP

func (hdlr *GeoIPFilterType) ServeHTTP(www http.ResponseWriter, req *http.Request)

type OnlyCountryCode

type OnlyCountryCode struct {
	Country struct {
		ISOCode string `maxminddb:"iso_code"`
	} `maxminddb:"country"`
}

This is drectly from the example code

Jump to

Keyboard shortcuts

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