package
0.0.0-20230101183712-202847b4b89b
Repository: https://github.com/corestoreio/csfw.git
Documentation: pkg.go.dev
# Packages
Package backendgeoip defines the backend configuration options and element slices.
Package maxmindfile provides an OptionFactoryFunc for the backendgeopip package.
Package maxmindwebservice provides an OptionFactoryFunc for the backendgeopip package.
# Functions
FromContextCountry returns the geoip.Country in ctx if it exists or an error.
MustNew same as New() but panics on error.
New creates a new GeoIP service to be used as a middleware or standalone.
NewOptionFactories creates a new struct and initializes the internal map for the registration of different option factories.
OptionsError helper function to be used within the backend package or other sub-packages whose functions may return an OptionFactoryFunc.
WithAllowedCountryCodes sets a list of ISO countries to be validated against.
WithAlternativeHandler sets for a scope the alternative handler if an IP address has been access denied.
WithAlternativeRedirect sets for a scope the error handler on a Service if an IP address has been access denied.
WithCheckAllow sets your custom function which checks if the country of an IP address should access to granted, or the next middleware handler in the chain gets called.
WithCountryFinder applies a custom CountryRetriever.
WithDebugLog creates a new standard library based logger with debug mode enabled.
WithDefaultConfig applies the default GeoIP configuration settings based for a specific scope.
WithDisable disables the current service and calls the next HTTP handler.
WithErrorHandler adds a custom error handler.
WithLogger convenient helper function to apply a logger to the Service type.
WithMarkPartiallyApplied if set to true marks a configuration for a scope as partially applied with functional options set via source code.
WithOptionFactory applies a function which lazily loads the options from a slow backend (config.Getter) depending on the incoming scope within a request.
WithRootConfig sets the root configuration service to retrieve the scoped base configuration.
WithServiceErrorHandler sets the error handler on the Service object.
# Variables
DefaultAlternativeHandler gets called when detected Country cannot be found within the list of allowed countries.
# Structs
The Country structure corresponds to the data in the GeoIP2/GeoLite2 Country databases.
OptionFactories allows to register multiple OptionFactoryFunc identified by their names.
ScopedConfig scoped based configuration and should not be embedded into your own types.
Service represents a service manager for GeoIP detection and restriction.
# Interfaces
Finder finds a Country by an IP address.
StoreFinder see store.Finder for a description.
# Type aliases
IsAllowedFunc checks in middleware WithIsCountryAllowedByIP if the country is allowed to process the request.
Option can be used as an argument in NewService to configure it with different settings.
OptionFactoryFunc a closure around a scoped configuration to figure out which options should be returned depending on the scope brought to you during a request.