models

package
v3.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionStatusActive   = "active"
	SessionStatusInactive = "inactive"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	CommandID int64   `gorm:"primary_key"`
	Session   Session `gorm:"foreignkey:SessionID;association_foreignkey:SessionID"`
	SessionID int64
	User      string `gorm:"index"`
	Content   string
	CreatedAt time.Time `sql:"not null;DEFAULT:current_timestamp"`
}

Command denotes the command typed by user

func (Command) Alert

func (c Command) Alert(s Session, g *global.Global) error

Alert alert dangerous command

func (Command) IsRisky

func (c Command) IsRisky() bool

IsRisky judge whether this command is risky

func (Command) SwaggerModel

func (c Command) SwaggerModel() swaggermodels.Command

SwaggerModel return the swagger version

type MailData

type MailData struct {
	Command    Command
	Session    Session
	LAINDomain string
}

MailData will be inserted into mailTemplate

type Session

type Session struct {
	SessionID   int64  `gorm:"primary_key"`
	User        string `gorm:"index"`
	SourceIP    string `gorm:"index"`
	AppName     string `gorm:"index"`
	ProcName    string
	InstanceNo  string
	ContainerID string
	NodeIP      string
	Status      string
	CreatedAt   time.Time `sql:"not null;DEFAULT:current_timestamp"`
	EndedAt     time.Time
	UpdatedAt   time.Time `sql:"not null;DEFAULT:current_timestamp"`
}

Session denotes a user session connected to a container

func NewSession

func NewSession(conn *websocket.Conn, r *http.Request, g *global.Global) (*Session, error)

NewSession initialize a session

func (Session) DataPath

func (s Session) DataPath() string

DataPath return the parent directory of typescript file and timing file

func (Session) SwaggerModel

func (s Session) SwaggerModel() swaggermodels.Session

SwaggerModel return the swagger version

func (Session) TimingFile

func (s Session) TimingFile() string

TimingFile return the file path which record time info for scriptrelpay

func (Session) TypescriptFile

func (s Session) TypescriptFile() string

TypescriptFile return the file path which record stdout/stderr for scriptrelpay

Jump to

Keyboard shortcuts

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