ipfilter

package
v0.0.0-...-2d3ebc1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Skipper:        middleware.DefaultSkipper,
	BlockByDefault: false,
}

DefaultConfig is the default IPFilter middleware config

Functions

func Middleware

func Middleware() echo.MiddlewareFunc

Middleware returns an IPFilter middleware to filter requests by ip matching / blocking.

func MiddlewareWithConfig

func MiddlewareWithConfig(config Config) echo.MiddlewareFunc

MiddlewareWithConfig returns an IPFilter middleware with config. See: `IPFilter()`.

Types

type Config

type Config struct {
	// Skipper defines a function to skip middleware.
	// default middleware.DefaultSkipper
	Skipper middleware.Skipper

	// WhiteList is an allowed ip list.
	WhiteList []string

	// BlackList is a disallowed ip list.
	BlackList []string

	// Block by default.
	BlockByDefault bool
}

Config defines the config for IPFilter middleware.

Jump to

Keyboard shortcuts

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