Help us shape the future of Go! Take the 2026 Go Developer Survey

iprestriction

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.9.0

func Init() error

Init registers the ip_restriction middleware.

Types

type IPRestriction

type IPRestriction struct {
	// contains filtered or unexported fields
}

IPRestriction is a middleware that allows or denies requests based on client IP.

func NewMiddleware

func NewMiddleware(options Options) (*IPRestriction, error)

NewMiddleware creates a new IPRestriction instance.

func (*IPRestriction) ServeHTTP

func (m *IPRestriction) ServeHTTP(ctx context.Context, c *app.RequestContext)

type Options

type Options struct {
	RejectedHTTPContentType  string   `mapstructure:"rejected_http_content_type"`
	RejectedHTTPResponseBody string   `mapstructure:"rejected_http_response_body"`
	Allow                    []string `mapstructure:"allow"`
	Deny                     []string `mapstructure:"deny"`
	RejectedHTTPStatusCode   int      `mapstructure:"rejected_http_status_code"`
}

Options defines the configuration for the IP restriction middleware.

Jump to

Keyboard shortcuts

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