models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	ID             uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt      time.Time `gorm:"->;<-:create;"`
	CommonName     string
	CAType         int
	KeyType        string
	CertificatePEM string
	PrivateKeyPEM  string
}

Certificate - Certificate database model

func (*Certificate) BeforeCreate

func (c *Certificate) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook to automatically set values

type FileDescription

type FileDescription struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	Size    int64  `json:"size"`
	Command string `json:"command"`
}

func (*FileDescription) ToJson

func (td *FileDescription) ToJson() (string, error)

type Listener

type Listener struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt time.Time `gorm:"->;<-:create;"`
	Name      string    `gorm:"uniqueIndex"`
}

Listener

func (*Listener) BeforeCreate

func (l *Listener) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

type Operator

type Operator struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt time.Time `gorm:"->;<-:create;"`
	Name      string    `gorm:"uniqueIndex"`
}

Operator - Colletions of content to serve from HTTP(S)

func (*Operator) BeforeCreate

func (o *Operator) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

type Os

type Os struct {
	Name     string `gorm:"type:varchar(255)" json:"name"`
	Version  string `gorm:"type:varchar(255)" json:"version"`
	Arch     string `gorm:"type:varchar(255)" json:"arch"`
	Username string `gorm:"type:varchar(255)" json:"username"`
	Hostname string `gorm:"type:varchar(255)" json:"hostname"`
	Locale   string `gorm:"type:varchar(255)" json:"locale"`
}

type Process

type Process struct {
	Name  string `gorm:"type:varchar(255)" json:"name"`
	Pid   int32  `json:"pid"`
	Ppid  int32  `json:"ppid"`
	Owner string `gorm:"type:varchar(255)" json:"owner"`
	Arch  string `gorm:"type:varchar(255)" json:"arch"`
	Path  string `gorm:"type:varchar(255)" json:"path"`
	Args  string `gorm:"type:varchar(255)" json:"args"`
}

type Session

type Session struct {
	SessionID  string    `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt  time.Time `gorm:"->;<-:create;"`
	Note       string
	GroupName  string
	RemoteAddr string
	ListenerId string
	IsAlive    bool
	Modules    string
	Extensions string
	Os         *Os      `gorm:"embedded"`
	Process    *Process `gorm:"embedded"`
	Time       *Timer   `gorm:"embedded"`
	Last       time.Time
}

func ConvertToSessionDB

func ConvertToSessionDB(session *core.Session) *Session

func (*Session) BeforeCreate

func (s *Session) BeforeCreate(tx *gorm.DB) (err error)

func (*Session) ToClientProtobuf

func (s *Session) ToClientProtobuf() *clientpb.Session

func (*Session) ToRegisterProtobuf

func (s *Session) ToRegisterProtobuf() *lispb.RegisterSession

type Task

type Task struct {
	ID          string    `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt   time.Time `gorm:"->;<-:create;"`
	Type        string
	SessionID   string
	Session     Session `gorm:"foreignKey:SessionID"`
	Cur         int
	Total       int
	Description string
}

func (*Task) BeforeCreate

func (t *Task) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

func (*Task) ToDescProtobuf

func (t *Task) ToDescProtobuf() *clientpb.TaskDesc

func (*Task) ToProtobuf

func (t *Task) ToProtobuf() *clientpb.Task

func (*Task) UpdateCur

func (t *Task) UpdateCur(db *gorm.DB, newCur int) error

type Timer

type Timer struct {
	Interval    uint64 `json:"interval"`
	Jitter      uint64 `json:"jitter"`
	Heartbeat   uint64 `json:"heartbeat"`
	LastCheckin uint64 `json:"last_checkin"`
}

type WebContent

type WebContent struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	WebsiteID uuid.UUID `gorm:"type:uuid;"`
	Website   Website   `gorm:"foreignKey:WebsiteID;"`

	Path        string `gorm:"primaryKey"`
	Size        uint64
	ContentType string
}

WebContent - One piece of content mapped to a path

func WebContentFromProtobuf

func WebContentFromProtobuf(pbWebContent *lispb.WebContent) WebContent

func (*WebContent) BeforeCreate

func (wc *WebContent) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook to automatically set values

func (*WebContent) ToProtobuf

func (wc *WebContent) ToProtobuf(content *[]byte) *lispb.WebContent

ToProtobuf - Converts to protobuf object

type Website

type Website struct {
	ID        uuid.UUID `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt time.Time `gorm:"->;<-:create;"`

	Name string `gorm:"unique;"` // Website Name

	WebContents []WebContent
}

Website - Colletions of content to serve from HTTP(S)

func (*Website) BeforeCreate

func (w *Website) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate - GORM hook

func (*Website) ToProtobuf

func (w *Website) ToProtobuf(webContentDir string) *lispb.Website

ToProtobuf - Converts to protobuf object

Jump to

Keyboard shortcuts

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