rules

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	MatchesRule(ri *RequestInfo) *Rule
	Rules() []Rule
	Errors() []string
	KnownRoles() []string
	AddRule(r Rule)
	WriteConfig() error
}

type DisplayableRule

type DisplayableRule struct {
	Name      string
	Source    string
	Protocol  string
	Host      string
	Path      string
	Roles     []string
	Timeout   string
	IsPublic  bool
	AdminOnly bool
}

func RuleToDisplayableRule

func RuleToDisplayableRule(r Rule) *DisplayableRule

type RequestInfo

type RequestInfo struct {
	Method     string
	Protocol   string
	Host       string
	RequestURI string
	SourceIP   net.IP
}

func (*RequestInfo) GetURL

func (ri *RequestInfo) GetURL() string

func (*RequestInfo) Valid

func (ri *RequestInfo) Valid() bool

type Rule

type Rule struct {
	Name            string
	SourceAddress   *net.IPNet
	ProtocolPattern *string
	HostPattern     *string
	PathPattern     *string
	Timeout         *time.Duration
	Public          bool
	PermittedRoles  []string
}

func New

func New(v *viper.Viper) (*Rule, error)

func (*Rule) Matches

func (r *Rule) Matches(ri *RequestInfo) bool

type ViperConfigAnalyzer

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

func NewFromConfig

func NewFromConfig() (*ViperConfigAnalyzer, error)

func (*ViperConfigAnalyzer) AddRule

func (a *ViperConfigAnalyzer) AddRule(r Rule)

func (*ViperConfigAnalyzer) Errors

func (a *ViperConfigAnalyzer) Errors() []string

func (*ViperConfigAnalyzer) KnownRoles

func (a *ViperConfigAnalyzer) KnownRoles() []string

func (*ViperConfigAnalyzer) MatchesRule

func (a *ViperConfigAnalyzer) MatchesRule(ri *RequestInfo) *Rule

func (*ViperConfigAnalyzer) Rules

func (a *ViperConfigAnalyzer) Rules() []Rule

func (*ViperConfigAnalyzer) UpdateFromConfigFile

func (a *ViperConfigAnalyzer) UpdateFromConfigFile() error

func (*ViperConfigAnalyzer) WriteConfig

func (a *ViperConfigAnalyzer) WriteConfig() error

Jump to

Keyboard shortcuts

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