authz

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const REFRESH_INTERVAL_SECONDS = 60

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowList added in v1.0.1

type AllowList interface {
	GetPermission(ipAddress string) Permission
}

AllowList maintains an allow list for IP addresses

type DatabaseAllowList added in v1.0.1

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

DatabaseAllowList implements database backed allow list.

func NewDatabaseAllowList added in v1.0.1

func NewDatabaseAllowList(
	ctx context.Context,
	db *bun.DB,
	log *zap.Logger,
) (*DatabaseAllowList, error)

func (*DatabaseAllowList) GetPermission added in v1.0.1

func (d *DatabaseAllowList) GetPermission(ipAddress string) Permission

Get the permissions for a IP address

func (*DatabaseAllowList) Stop added in v1.0.1

func (d *DatabaseAllowList) Stop()

type IPAddress added in v1.0.1

type IPAddress struct {
	bun.BaseModel `bun:"table:ip_addresses"`

	ID         int64      `bun:",pk,autoincrement"`
	IPAddress  string     `bun:"ip_address,notnull"`
	CreatedAt  time.Time  `bun:"created_at"`
	DeletedAt  *time.Time `bun:"deleted_at"`
	Permission string     `bun:"permission"`
	Comment    string     `bun:"comment"`
}

type Permission

type Permission int64
const (
	Unspecified Permission = 0
	AllowAll    Permission = 1
	Priority    Permission = 2
	Denied      Permission = 3
)

func (Permission) String

func (p Permission) String() string

Add a string function to use for logging

Jump to

Keyboard shortcuts

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