models

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrIncidentIsNotSet  = "incident is not set"
	ErrIncidentTypeError = "incident type error"
)
View Source
const (
	IncidentType_IllegalAccessAttempt            = 1
	IncidentType_FakeToken                       = 2
	IncidentType_VerificationCodeMismatch        = 3
	IncidentType_DoubleLogInAttempt              = 4
	IncidentType_PreSessionHacking               = 5
	IncidentType_CaptchaAnswerMismatch           = 6
	IncidentType_PasswordMismatch                = 7
	IncidentType_PasswordChangeHacking           = 8
	IncidentType_EmailChangeHacking              = 9
	IncidentType_FakeIPA                         = 10
	IncidentType_ReadingNotificationOfOtherUsers = 11
	IncidentType_WrongDKey                       = 12
)
View Source
const (
	Module_ACM  = Module(1)
	Module_GWM  = Module(2)
	Module_MM   = Module(3)
	Module_NM   = Module(4)
	Module_RCS  = Module(5)
	Module_SM   = Module(6)
	Module_SMTP = Module(7)
)
View Source
const (
	CookieName_Token = "token"
)
View Source
const (
	IncidentTypesCount = 12
)

Variables

This section is empty.

Functions

func CheckIncident added in v0.0.39

func CheckIncident(inc *Incident) (err error)

func GetToken

func GetToken(req *http.Request) (token *string, err error)

GetToken tries to read a token. If a token is not found, null is returned.

func NewArrayFromScannableSource

func NewArrayFromScannableSource[T any](src IScannableSequence) (values []T, err error)

func NewNonNullValueFromScannableSource added in v0.0.39

func NewNonNullValueFromScannableSource[T any](src IScannable) (T, error)

func NewStringFromScannableSource added in v0.0.38

func NewStringFromScannableSource(src IScannable) (s *string, err error)

func NewValueFromScannableSource

func NewValueFromScannableSource[T any](src IScannable) (*T, error)

func NormalisePath added in v0.0.8

func NormalisePath(path string) string

Types

type IApplication

type IApplication interface {
	Use() error
}

type IScannable

type IScannable interface {
	Scan(dest ...any) error
}

type IScannableSequence

type IScannableSequence interface {
	IScannable
	Next() bool // = HasNextValue()
}

type IServer

type IServer interface {
	Start() error
	ReportStart()
	Stop() error
	GetStopChannel() *chan bool
	UseConstructor(ISettings) (IServer, error)
	GetSubRoutinesWG() *sync.WaitGroup
	GetMustStopAB() *atomic.Bool
}

type ISettings

type ISettings interface {
	Check() error
	UseConstructor(string, *ver.Versioneer) (ISettings, error)
}

type Incident added in v0.0.39

type Incident struct {
	Id      uint
	Module  byte
	Type    IncidentType
	Time    time.Time
	Email   string
	UserIPA net.IP
}

type IncidentType added in v0.0.39

type IncidentType byte

func (IncidentType) IsValid added in v0.0.39

func (it IncidentType) IsValid() (ok bool)

type Module added in v0.0.39

type Module byte

type ScheduledFn added in v0.0.40

type ScheduledFn = func() error

type Scheduler added in v0.0.40

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

func NewScheduler added in v0.0.40

func NewScheduler(srv IServer, funcs60 []ScheduledFn) (s *Scheduler)

func (*Scheduler) Run added in v0.0.40

func (s *Scheduler) Run()

type UserParameters

type UserParameters struct {
	Id           uint      `json:"id"`
	PreRegTime   time.Time `json:"preRegTime"`
	Email        string    `json:"email"`
	Name         string    `json:"name"`
	ApprovalTime time.Time `json:"approvalTime"`
	RegTime      time.Time `json:"regTime"`
	UserRoles
	LastBadLogInTime  *time.Time `json:"lastBadLogInTime"`
	BanTime           *time.Time `json:"banTime"`
	LastBadActionTime *time.Time `json:"lastBadActionTime"`
}

func NewUserParameters

func NewUserParameters() (up *UserParameters)

func NewUserParametersFromScannableSource

func NewUserParametersFromScannableSource(src IScannable) (up *UserParameters, err error)

type UserRoles

type UserRoles struct {
	IsAdministrator bool `json:"isAdministrator"`
	IsModerator     bool `json:"isModerator"`
	IsAuthor        bool `json:"isAuthor"`
	IsWriter        bool `json:"isWriter"`
	IsReader        bool `json:"isReader"`
	CanLogIn        bool `json:"canLogIn"`
}

func NewUserRoles

func NewUserRoles() (ur *UserRoles)

func NewUserRolesFromScannableSource

func NewUserRolesFromScannableSource(src IScannable) (ur *UserRoles, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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