models

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToProtobuf added in v0.0.2

func ToProtobuf(pipeline *Pipeline) *lispb.Pipeline

func ToTlsProtobuf added in v0.0.2

func ToTlsProtobuf(tls *TlsConfig) *lispb.TLS

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 EncryptionConfig added in v0.0.2

type EncryptionConfig struct {
	Enable bool   `gorm:"column:enable"`
	Type   string `gorm:"column:type"`
	Key    string `gorm:"column:key"`
}

type FileDescription

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

func (*FileDescription) ToJsonString added in v0.0.2

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

type Operator

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

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 Pipeline added in v0.0.2

type Pipeline struct {
	ID         uuid.UUID        `gorm:"primaryKey;->;<-:create;type:uuid;"`
	CreatedAt  time.Time        `gorm:"->;<-:create;"`
	ListenerID string           `gorm:"type:string;"`
	Name       string           `gorm:"type:string"`
	WebPath    string           `gorm:"type:string;default:''"`
	Host       string           `config:"host"`
	Port       uint16           `config:"port"`
	Type       string           `gorm:"type:string;"`
	Enable     bool             `gorm:"type:boolean;"`
	Tls        TlsConfig        `gorm:"embedded;embeddedPrefix:tls_"`
	Encryption EncryptionConfig `gorm:"embedded;embeddedPrefix:encryption_"`
}

Pipeline

func ProtoBufToDB added in v0.0.2

func ProtoBufToDB(pipeline *lispb.Pipeline) Pipeline

func (*Pipeline) BeforeCreate added in v0.0.2

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

BeforeCreate - GORM hook

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
	IsRemoved  bool     `gorm:"default:false"`
	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) ToFileProtobuf added in v0.0.2

func (t *Task) ToFileProtobuf() *clientpb.File

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 TlsConfig added in v0.0.2

type TlsConfig struct {
	Enable bool   `gorm:"column:enable"`
	Cert   string `gorm:"column:cert"`
	Key    string `gorm:"column:key"`
}

func ToTlsDB added in v0.0.2

func ToTlsDB(tls *lispb.TLS) TlsConfig

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