Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct {
ID int `gorm:"primaryKey;not null" json:"-"`
// User is UUID of the user that triggered this event, or an empty string if the event
// cannot be tied to a specific user, in which case we will assume it was the system
// user.
User JsonNullString `gorm:"type:uuid" json:"user"`
// Server is the UUID of the server this event is associated with.
Server string `gorm:"type:uuid;not null" json:"server"`
// Event is a string that describes what occurred, and is used by the Panel instance to
// properly associate this event in the activity logs.
Event Event `gorm:"index;not null" json:"event"`
// Metadata is either a null value, string, or a JSON blob with additional event specific
// metadata that can be provided.
Metadata ActivityMeta `gorm:"serializer:json" json:"metadata"`
// IP is the IP address that triggered this event, or an empty string if it cannot be
// determined properly. This should be the connecting user's IP address, and not the
// internal system IP.
IP string `gorm:"not null" json:"ip"`
Timestamp time.Time `gorm:"not null" json:"timestamp"`
}
Activity defines an activity log event for a server entity performed by a user. This is used for tracking commands, power actions, and SFTP events so that they can be reconciled and sent back to the Panel instance to be displayed to the user.
func (*Activity) BeforeCreate ¶
BeforeCreate executes before we create any activity entry to ensure the IP address is trimmed down to remove any extraneous data, and the timestamp is set to the current system time and then stored as UTC.
type ActivityMeta ¶
type ActivityMeta map[string]interface{}
type FirewallRule ¶ added in v1.1.0
type FirewallRule struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
// Server UUID that this rule applies to
ServerUUID string `gorm:"index;not null" json:"server_uuid"`
// Remote IP address (CIDR notation supported, e.g., "192.168.1.1/32" or "192.168.1.0/24")
RemoteIP string `gorm:"not null" json:"remote_ip"`
// Server port this rule applies to
ServerPort int `gorm:"not null" json:"server_port"`
// Priority determines the order rules are applied (lower number = higher priority)
Priority int `gorm:"default:100;not null" json:"priority"`
// Type of rule: "allow" or "block"
Type FirewallRuleType `gorm:"not null" json:"type"`
// Protocol (tcp/udp/both) - defaults to tcp
Protocol string `gorm:"default:tcp;not null" json:"protocol"`
}
FirewallRule represents a firewall rule for a server
func (FirewallRule) TableName ¶ added in v1.1.0
func (FirewallRule) TableName() string
TableName specifies the table name for GORM
type FirewallRuleType ¶ added in v1.1.0
type FirewallRuleType string
FirewallRuleType represents the type of firewall rule
const ( FirewallRuleTypeAllow FirewallRuleType = "allow" FirewallRuleTypeBlock FirewallRuleType = "block" )
type JsonNullString ¶
type JsonNullString struct {
sql.NullString
}
func (JsonNullString) MarshalJSON ¶
func (v JsonNullString) MarshalJSON() ([]byte, error)
func (*JsonNullString) UnmarshalJSON ¶
func (v *JsonNullString) UnmarshalJSON(data []byte) error
type Module ¶ added in v1.1.0
type Module struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Name string `gorm:"uniqueIndex;not null" json:"name"`
Enabled bool `gorm:"default:false" json:"enabled"`
Config string `gorm:"type:text" json:"config"` // JSON encoded config
}
Module represents a module's persisted state and configuration