Documentation
¶
Index ¶
- Constants
- func Delete(v interface{}) error
- func Save(v interface{}) error
- func Setup(config Config) (err error)
- func ToJSONB(v interface{}) datatypes.JSON
- func UpdateAgent(agent *Agent, fields *AgentWritableFields) error
- func VerifyUser(verification string) error
- type Agent
- type AgentWritableFields
- type Config
- type JSONB
- type User
Constants ¶
View Source
const MaxAgentRules = 100
View Source
const MaxAlertAfter = 21600 // 6 hours
View Source
const MaxAlertPeriod = 10800 // 3 hours
View Source
const MinAgentNameLength = 3
View Source
const MinAlertAfter = 30 // 30 seconds
View Source
const MinAlertPeriod = 1800 // 30 minutes
View Source
const MinPasswordLength = 8
Variables ¶
This section is empty.
Functions ¶
func UpdateAgent ¶
func UpdateAgent(agent *Agent, fields *AgentWritableFields) error
func VerifyUser ¶
Types ¶
type Agent ¶
type Agent struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `gorm:"index" json:"created_at"`
UpdatedAt time.Time `gorm:"index" json:"updated_at"`
SeenAt time.Time `gorm:"index" json:"seen_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
UserID uint `gorm:"index" json:"-"`
AlertAfter uint `gorm:"index" json:"alert_after"`
AlertPeriod uint `gorm:"index" json:"alert_period"`
AlertAt time.Time `gorm:"index" json:"alert_at"`
Name string `json:"name"`
Rules datatypes.JSON `sql:"type:jsonb" json:"rules"`
Token string `gorm:"index" json:"token"`
Address string `json:"address"`
UserAgent string `json:"user_agent"`
}
func FindAgentByToken ¶
func FindAgentsForAlert ¶ added in v1.1.0
func RegisterAgent ¶
func RegisterAgent(fields *AgentWritableFields) (*Agent, error)
type AgentWritableFields ¶ added in v1.1.0
type AgentWritableFields struct {
ID uint
Name string
Rules []*firewall.Rule
User *User
AlertAfter uint
AlertPeriod uint
}
func (*AgentWritableFields) Validate ¶ added in v1.1.0
func (f *AgentWritableFields) Validate() error
type User ¶
type User struct {
ID uint `gorm:"primarykey" json:"-""`
CreatedAt time.Time `gorm:"index" json:"created_at"`
UpdatedAt time.Time `gorm:"index" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Email string `gorm:"uniqueIndex" json:"email"`
Verification string `gorm:"index" json:"-"`
Verified bool `gorm:"index" json:"-"`
Use2FA bool `gorm:"default:true" json:"use_2fa"` // i know it's not 2fa yet
Hash string `json:"-"`
Address string `json:"address"`
Agents []Agent `json:"-"`
}
func FindUserByID ¶
func RegisterUser ¶
Click to show internal directories.
Click to hide internal directories.