firewall

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attempt

type Attempt struct {
	Roles  []auth.Role
	Secret string
}

type Config

type Config interface {
}

func Enabled

func Enabled(enabled ...bool) Config

func Groups

func Groups(groups ...string) Config

func Matchers

func Matchers(matchers ...*regexp.Regexp) Config

func Name

func Name(name string) Config

func Paths

func Paths(paths ...string) Config

func Redirect

func Redirect(redirect string) Config

func Roles

func Roles(roles ...auth.Role) Config

func Secret

func Secret(secret string) Config

type Firewall

type Firewall struct {
	Enabled  bool
	Name     string
	Groups   []string
	Matchers []*regexp.Regexp
	Paths    []string
	Redirect string
	Roles    []auth.Role
	Secret   string
}

func New

func New(configs ...Config) *Firewall

func (*Firewall) Match

func (f *Firewall) Match(path string) bool

func (*Firewall) MatchGroup

func (f *Firewall) MatchGroup(group string) bool

func (*Firewall) MatchPath

func (f *Firewall) MatchPath(path string) bool

func (*Firewall) Try

func (f *Firewall) Try(attempt Attempt) Result

type Result

type Result struct {
	Ok       bool
	Err      error
	Redirect string
}

Jump to

Keyboard shortcuts

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