ban

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ISODate = "2006-01-02T15:04:05"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ban

type Ban struct {
	IP       net.IP
	Mask     int
	Username string
	CertHash string
	Reason   string
	Start    int64
	Duration uint32
}

func (Ban) IPMask

func (ban Ban) IPMask() (mask net.IPMask)

Create a net.IPMask from a specified amount of mask bits

func (Ban) ISOStartDate

func (ban Ban) ISOStartDate() string

ISOStartDate returns the currently set start date as an ISO 8601-formatted date (in UTC).

func (Ban) IsExpired

func (ban Ban) IsExpired() bool

IsExpired checks whether a ban has expired

func (Ban) Match

func (ban Ban) Match(ip net.IP) bool

Match checks whether an IP matches a Ban

func (*Ban) SetISOStartDate

func (ban *Ban) SetISOStartDate(isodate string)

Set Start date from an ISO 8601 date (in UTC)

Jump to

Keyboard shortcuts

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