object

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoConnect    = "no_connect"
	Connecting   = "connecting"
	Connected    = "connected"
	Disconnected = "disconnected"
)

Variables

View Source
var (
	RestartClientChan chan string
)

Functions

func AddAsset

func AddAsset(asset *Asset) (bool, error)

func AddCommand added in v1.32.0

func AddCommand(command *Command) (bool, error)

func AddRecord

func AddRecord(record *Record) bool

func AddSession

func AddSession(session *Session) (bool, error)

func AssetHook

func AssetHook(asset *Asset, oldAsset *Asset, action string) error

func CloseDBSession

func CloseDBSession(id string, code int, msg string) error

func CloseSession

func CloseSession(id string, code int, msg string) error

func DeleteAsset

func DeleteAsset(asset *Asset) (bool, error)

func DeleteCommand added in v1.32.0

func DeleteCommand(command *Command) (bool, error)

func DeleteRecord

func DeleteRecord(record *Record) (bool, error)

func DeleteSession

func DeleteSession(session *Session) (bool, error)

func DeleteSessionById

func DeleteSessionById(id string) (bool, error)

func GetAssetCount

func GetAssetCount(owner, field, value string) (int64, error)

func GetCommandCount added in v1.32.0

func GetCommandCount(owner, field, value string) (int64, error)

func GetExecOutput added in v1.32.0

func GetExecOutput(command *Command) (map[string]string, error)

func GetRecordCount

func GetRecordCount(owner, field, value string) (int64, error)

func GetSession

func GetSession(owner string, offset, limit int, field, value, sortField, sortOrder string) *xorm.Session

func GetSessionCount

func GetSessionCount(owner, status, field, value string) (int64, error)

func InitAdapter

func InitAdapter()

func InitConfig

func InitConfig()

func UpdateAsset

func UpdateAsset(id string, asset *Asset) (bool, error)

func UpdateCommand added in v1.32.0

func UpdateCommand(id string, command *Command) (bool, error)

func UpdateRecord

func UpdateRecord(id string, record *Record) (bool, error)

func UpdateSession

func UpdateSession(id string, session *Session, columns ...string) (bool, error)

func WriteCloseMessage

func WriteCloseMessage(session *guacamole.Session, mode string, code int, msg string)

Types

type Adapter

type Adapter struct {
	Engine *xorm.Engine
	// contains filtered or unexported fields
}

Adapter represents the MySQL adapter for policy storage.

func NewAdapter

func NewAdapter(driverName string, dataSourceName string) *Adapter

NewAdapter is the constructor for Adapter.

type Asset

type Asset struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Category string `xorm:"varchar(20)" json:"category"`
	Type     string `xorm:"varchar(100)" json:"type"`
	Tag      string `xorm:"varchar(200)" json:"tag"`

	Endpoint string `xorm:"varchar(100)" json:"endpoint"`
	Port     int    `json:"port"`
	Username string `xorm:"varchar(100)" json:"username"`
	Password string `xorm:"varchar(200)" json:"password"`

	Os              string       `xorm:"varchar(100)" json:"os"`
	Language        string       `xorm:"varchar(20)" json:"language"`
	AutoQuery       bool         `json:"autoQuery"`
	IsPermanent     bool         `json:"isPermanent"`
	EnableRemoteApp bool         `json:"enableRemoteApp"`
	RemoteApps      []*RemoteApp `json:"remoteApps"`
	Services        []*Service   `json:"services"`
	GatewayPort     int          `json:"gatewayPort"`

	Id              string `xorm:"varchar(100)" json:"id"`
	DatabaseUrl     string `xorm:"varchar(200)" json:"databaseUrl"`
	UseDatabaseUrl  bool   `json:"useDatabaseUrl"`
	DatabaseFile    string `xorm:"varchar(200)" json:"databaseFile"`
	SocketPath      string `xorm:"varchar(200)" json:"socketPath"`
	AuthType        string `xorm:"varchar(100)" json:"authType"`
	DefaultDatabase string `xorm:"varchar(100)" json:"defaultDatabase"`
	IsReadOnly      bool   `json:"isReadOnly"`
}

func GetAsset

func GetAsset(id string) (*Asset, error)

func GetAssets

func GetAssets(owner string) ([]*Asset, error)

func GetAssetsByName

func GetAssetsByName(owner, name string, isAdmin bool) ([]*Asset, error)

func GetMaskedAsset

func GetMaskedAsset(asset *Asset, errs ...error) (*Asset, error)

func GetMaskedAssets

func GetMaskedAssets(assets []*Asset, errs ...error) ([]*Asset, error)

func GetPaginationAssets

func GetPaginationAssets(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Asset, error)

func (*Asset) GetId added in v1.31.0

func (asset *Asset) GetId() string

type Command added in v1.32.0

type Command struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Assets  []string `json:"assets"`
	Command string   `xorm:"mediumtext" json:"command"`
}

func GetCommand added in v1.32.0

func GetCommand(id string) (*Command, error)

func GetCommands added in v1.32.0

func GetCommands(owner string) ([]*Command, error)

func GetPaginationCommands added in v1.32.0

func GetPaginationCommands(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Command, error)

func (*Command) GetId added in v1.32.0

func (c *Command) GetId() string

type Record

type Record struct {
	Id int `xorm:"int notnull pk autoincr" json:"id"`

	Owner       string `xorm:"varchar(100) index" json:"owner"`
	Name        string `xorm:"varchar(100) index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	ClientIp     string `xorm:"varchar(100)" json:"clientIp"`
	User         string `xorm:"varchar(100)" json:"user"`
	Method       string `xorm:"varchar(100)" json:"method"`
	RequestUri   string `xorm:"varchar(1000)" json:"requestUri"`
	Action       string `xorm:"varchar(1000)" json:"action"`

	Object string `xorm:"-" json:"object"`

	IsTriggered bool `json:"isTriggered"`
}

func GetPaginationRecords

func GetPaginationRecords(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Record, error)

func GetRecord

func GetRecord(id string) (*Record, error)

func GetRecords

func GetRecords(owner string) ([]*Record, error)

func NewRecord

func NewRecord(ctx *context.Context) *Record

type RemoteApp

type RemoteApp struct {
	No            int    `json:"no"`
	RemoteAppName string `xorm:"varchar(100)" json:"remoteAppName"`
	RemoteAppDir  string `xorm:"varchar(100)" json:"remoteAppDir"`
	RemoteAppArgs string `xorm:"varchar(100)" json:"remoteAppArgs"`
}

type Service

type Service struct {
	No             int    `json:"no"`
	Name           string `json:"name"`
	Path           string `json:"path"`
	Port           int    `json:"port"`
	ProcessId      int    `json:"processId"`
	ExpectedStatus string `json:"expectedStatus"`
	Status         string `json:"status"`
	SubStatus      string `json:"subStatus"`
	Message        string `json:"message"`
}

type Session

type Session struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	StartTime string `xorm:"varchar(100)" json:"startTime"`
	EndTime   string `xorm:"varchar(100)" json:"endTime"`

	Protocol      string `xorm:"varchar(20)" json:"protocol"`
	ConnectionId  string `xorm:"varchar(50)" json:"connectionId"`
	Asset         string `xorm:"varchar(200) index" json:"asset"`
	Creator       string `xorm:"varchar(36) index" json:"creator"`
	ClientIp      string `xorm:"varchar(200)" json:"clientIp"`
	UserAgent     string `xorm:"varchar(200)" json:"userAgent"`
	ClientIpDesc  string `xorm:"varchar(100)" json:"clientIpDesc"`
	UserAgentDesc string `xorm:"varchar(100)" json:"userAgentDesc"`
	Width         int    `json:"width"`
	Height        int    `json:"height"`
	Status        string `xorm:"varchar(20) index" json:"status"`
	Recording     string `xorm:"varchar(1000)" json:"recording"`
	Code          int    `json:"code"`
	Message       string `json:"message"`

	Mode       string   `xorm:"varchar(10)" json:"mode"`
	Operations []string `xorm:"json varchar(1000)" json:"operations"`

	Reviewed     bool  `json:"reviewed"`
	CommandCount int64 `json:"commandCount"`
}

func CreateSession

func CreateSession(session *Session, assetId, mode string) (*Session, error)

func GetConnSession

func GetConnSession(id string) (*Session, error)

func GetPaginationSessions

func GetPaginationSessions(owner, status string, offset, limit int, field, value, sortField, sortOrder string) ([]*Session, error)

func GetSessions

func GetSessions(owner string) ([]*Session, error)

func GetSessionsByStatus

func GetSessionsByStatus(statuses []string) ([]*Session, error)

func (*Session) GetId

func (s *Session) GetId() string

Jump to

Keyboard shortcuts

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