s

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockTimePerIncident

type BlockTimePerIncident struct {
	IllegalAccessAttempt     uint `json:"illegalAccessAttempt"`     // 1.
	FakeToken                uint `json:"fakeToken"`                // 2.
	VerificationCodeMismatch uint `json:"verificationCodeMismatch"` // 3.
	DoubleLogInAttempt       uint `json:"doubleLogInAttempt"`       // 4.
	PreSessionHacking        uint `json:"preSessionHacking"`        // 5.
	CaptchaAnswerMismatch    uint `json:"captchaAnswerMismatch"`    // 6.
	PasswordMismatch         uint `json:"passwordMismatch"`         // 7.
	PasswordChangeHacking    uint `json:"passwordChangeHacking"`    // 8.
	EmailChangeHacking       uint `json:"emailChangeHacking"`       // 9.
}

BlockTimePerIncident is block time in seconds for each type of incident.

type CaptchaImageSettings

type CaptchaImageSettings struct {
	// Images Server.
	Schema string `json:"schema"`
	Host   string `json:"host"`
	Port   uint16 `json:"port"`
	Path   string `json:"path"`
}

CaptchaImageSettings are settings of captcha images.

func (CaptchaImageSettings) Check

func (s CaptchaImageSettings) Check() (err error)

type DbSettings

type DbSettings = cs.DbSettings

DbSettings are parameters of the database.

type HttpsSettings

type HttpsSettings = cs.HttpsSettings

HttpsSettings are settings of an HTTPS server for incoming requests.

type JWTSettings

type JWTSettings struct {
	PrivateKeyFilePath string `json:"privateKeyFilePath"`
	PublicKeyFilePath  string `json:"publicKeyFilePath"`
	SigningMethod      string `json:"signingMethod"`
}

JWTSettings are settings for JSON web tokens.

func (JWTSettings) Check

func (s JWTSettings) Check() (err error)

type MessageSettings

type MessageSettings struct {
	SubjectTemplate            string `json:"subjectTemplate"`
	BodyTemplateForReg         string `json:"bodyTemplateForReg"`
	BodyTemplateForLogIn       string `json:"bodyTemplateForLogIn"`
	BodyTemplateForPwdChange   string `json:"bodyTemplateForPwdChange"`
	BodyTemplateForEmailChange string `json:"bodyTemplateForEmailChange"`
}

MessageSettings are settings of e-mail messages.

func (MessageSettings) Check

func (s MessageSettings) Check() (err error)

type Settings

type Settings struct {
	// Path to the file with these settings.
	FilePath string `json:"-"`

	// Program versioning information.
	VersionInfo *ver.Versioneer `json:"-"`

	HttpsSettings    `json:"https"`
	DbSettings       `json:"db"`
	SystemSettings   `json:"system"`
	JWTSettings      `json:"jwt"`
	UserRoleSettings `json:"role"`
	MessageSettings  `json:"message"`

	// Settings of host storing captcha images.
	CaptchaImageSettings `json:"captcha"`

	// External services.
	GwmSettings  cs.ServiceClientSettings `json:"gwm"`
	SmtpSettings cs.ServiceClientSettings `json:"smtp"`
	RcsSettings  cs.ServiceClientSettings `json:"rcs"`
}

Settings is Server's settings.

func NewSettingsFromFile

func NewSettingsFromFile(filePath string, versionInfo *ver.Versioneer) (stn *Settings, err error)

func (*Settings) Check

func (stn *Settings) Check() (err error)

func (*Settings) UseConstructor

func (stn *Settings) UseConstructor(filePath string, versionInfo *ver.Versioneer) (cm.ISettings, error)

type SystemSettings

type SystemSettings struct {
	SiteName                     string `json:"siteName"`
	SiteDomain                   string `json:"siteDomain"`
	VerificationCodeLength       int    `json:"verificationCodeLength"`
	UserNameMaxLenInBytes        uint   `json:"userNameMaxLenInBytes"`
	UserPasswordMaxLenInBytes    uint   `json:"userPasswordMaxLenInBytes"`
	PreRegUserExpirationTime     uint   `json:"preRegUserExpirationTime"`
	IsAdminApprovalRequired      bool   `json:"isAdminApprovalRequired"`
	LogInRequestIdLength         int    `json:"logInRequestIdLength"`
	LogInTryTimeout              uint   `json:"logInTryTimeout"`
	PreSessionExpirationTime     uint   `json:"preSessionExpirationTime"`
	SessionMaxDuration           uint   `json:"sessionMaxDuration"`
	PasswordChangeExpirationTime uint   `json:"passwordChangeExpirationTime"`
	EmailChangeExpirationTime    uint   `json:"emailChangeExpirationTime"`
	ActionTryTimeout             uint   `json:"actionTryTimeout"`

	// This setting must be synchronised with settings of the Gateway module.
	IsTableOfIncidentsUsed bool `json:"isTableOfIncidentsUsed"`

	// This setting is used only when a table of incidents is enabled.
	BlockTimePerIncident BlockTimePerIncident `json:"blockTimePerIncident"`

	IsDebugMode bool `json:"isDebugMode"`
}

SystemSettings are system settings.

func (SystemSettings) Check

func (s SystemSettings) Check() (err error)

type UserRoleSettings

type UserRoleSettings struct {
	// List of IDs of users having a moderator role.
	ModeratorIds []uint `json:"moderatorIds"`

	// List of IDs of users having an administrator role.
	AdministratorIds []uint `json:"administratorIds"`
}

UserRoleSettings are settings for special user roles.

func (UserRoleSettings) Check

func (s UserRoleSettings) Check() (err error)

Jump to

Keyboard shortcuts

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