controllers

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: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TunnelClosed       int = -1
	Normal             int = 0
	SessionNotFound    int = 800
	NewTunnelError     int = 801
	ForcedDisconnect   int = 802
	AssetNotActive     int = 803
	ParametersError    int = 804
	AssetNotFound      int = 805
	SessionUpdateError int = 806
)

Variables

View Source
var JwtPublicKey string
View Source
var UpGrader = websocket.Upgrader{
	ReadBufferSize:  4096,
	WriteBufferSize: 4096,
	CheckOrigin: func(r *http.Request) bool {
		return true
	},
	Subprotocols: []string{"guacamole"},
}

Functions

func ConvertMessageDataToJSON added in v1.32.0

func ConvertMessageDataToJSON(data string) ([]byte, error)

func GetUserName

func GetUserName(user *casdoorsdk.User) string

func InitAuthConfig

func InitAuthConfig()

Types

type ApiController

type ApiController struct {
	beego.Controller
}

func (*ApiController) AddAsset

func (c *ApiController) AddAsset()

AddAsset @Title AddAsset @Tag Asset API @Description add a asset @Param body body object.Asset true "The details of the asset" @Success 200 {object} controllers.Response The Response object @router /add-asset [post]

func (*ApiController) AddAssetTunnel

func (c *ApiController) AddAssetTunnel()

AddAssetTunnel @Title AddAssetTunnel @Tag Session API @Description add session @Param assetId query string true "The id of asset" @Success 200 {object} Response @router /add-asset-tunnel [get]

func (*ApiController) AddCommand added in v1.32.0

func (c *ApiController) AddCommand()

AddCommand @Title AddCommand @Tag Command API @Description add a command @Param command body object.Command true "The command object" @Success 200 {string} The Response object @router /add-command [post]

func (*ApiController) AddRecord

func (c *ApiController) AddRecord()

AddRecord @Title AddRecord @Tag Record API @Description add a record @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /add-record [post]

func (*ApiController) AddSession

func (c *ApiController) AddSession()

AddSession @Title AddSession @Tag Session API @Description add session @Param body body object.Session @Success 200 {object} Response @router /add-session [post]

func (*ApiController) DeleteAsset

func (c *ApiController) DeleteAsset()

DeleteAsset @Title DeleteAsset @Tag Asset API @Description delete a asset @Param body body object.Asset true "The details of the asset" @Success 200 {object} controllers.Response The Response object @router /delete-asset [post]

func (*ApiController) DeleteCommand added in v1.32.0

func (c *ApiController) DeleteCommand()

DeleteCommand @Title DeleteCommand @Tag Command API @Description delete the command @Param id query string true "The id ( owner/name ) of the command" @Success 200 {string} The Response object @router /delete-command [post]

func (*ApiController) DeleteRecord

func (c *ApiController) DeleteRecord()

DeleteRecord @Title DeleteRecord @Tag Record API @Description delete a record @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /delete-record [post]

func (*ApiController) DeleteSession

func (c *ApiController) DeleteSession()

DeleteSession @Title DeleteSession @Tag Session API @Description delete session @Param id query string true "The id of session" @Success 200 {object} Response @router /delete-session [post]

func (*ApiController) ExecCommand added in v1.32.0

func (c *ApiController) ExecCommand()

ExecCommand @Title ExecCommand @Tag Command API @Description execute the command @Param id query string true "The id ( owner/name ) of the command" @Param assetId query string true "The id of the asset" @Success 200 {stream} string "An event stream of the command output in multiple ssh terminal" @router /exec-command [get]

func (*ApiController) GetAccount

func (c *ApiController) GetAccount()

func (*ApiController) GetAsset

func (c *ApiController) GetAsset()

GetAsset @Title GetAsset @Tag Asset API @Description get asset @Param id query string true "The id ( owner/name ) of the asset" @Success 200 {object} object.Asset The Response object @router /get-asset [get]

func (*ApiController) GetAssetTunnel

func (c *ApiController) GetAssetTunnel()

func (*ApiController) GetAssets

func (c *ApiController) GetAssets()

GetAssets @Title GetAssets @Tag Asset API @Description get all assets @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Asset The Response object @router /get-assets [get]

func (*ApiController) GetCommand added in v1.32.0

func (c *ApiController) GetCommand()

GetCommand @Title GetCommand @Tag Command API @Description get the command @Param id query string true "The id ( owner/name ) of the command" @Success 200 {object} object.Command The Response object @router /get-command [get]

func (*ApiController) GetCommands added in v1.32.0

func (c *ApiController) GetCommands()

GetCommands @Title GetCommands @Tag Command API @Description get all commands @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Command The Response object @router /get-commands [get]

func (*ApiController) GetConnSession

func (c *ApiController) GetConnSession()

GetConnSession @Title GetConnSession @Tag Session API @Description get session @Param id query string true "The id of session" @Success 200 {object} object.Session @router /get-session [get]

func (*ApiController) GetExecOutput added in v1.32.0

func (c *ApiController) GetExecOutput()

func (*ApiController) GetRecord

func (c *ApiController) GetRecord()

GetRecord @Title GetRecord @Tag Record API @Description get record @Param id query string true "The id ( owner/name ) of the record" @Success 200 {object} object.Record The Response object @router /get-record [get]

func (*ApiController) GetRecords

func (c *ApiController) GetRecords()

GetRecords @Title GetRecords @Tag Record API @Description get all records @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Record The Response object @router /get-records [get]

func (*ApiController) GetSessionClaims

func (c *ApiController) GetSessionClaims() *casdoorsdk.Claims

func (*ApiController) GetSessionUser

func (c *ApiController) GetSessionUser() *casdoorsdk.User

func (*ApiController) GetSessionUsername

func (c *ApiController) GetSessionUsername() string

func (*ApiController) GetSessions

func (c *ApiController) GetSessions()

GetSessions @Title GetSessions @Tag Session API @Description get all sessions @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Session The Response object @router /get-sessions [get]

func (*ApiController) IsAdmin

func (c *ApiController) IsAdmin() bool

func (*ApiController) IsGlobalAdmin

func (c *ApiController) IsGlobalAdmin() bool

func (*ApiController) RequireAdmin

func (c *ApiController) RequireAdmin() (string, bool)

func (*ApiController) RequireSignedIn

func (c *ApiController) RequireSignedIn() bool

func (*ApiController) ResponseError

func (c *ApiController) ResponseError(error string, data ...interface{})

func (*ApiController) ResponseErrorStream added in v1.32.0

func (c *ApiController) ResponseErrorStream(errorText string)

func (*ApiController) ResponseOk

func (c *ApiController) ResponseOk(data ...interface{})

func (*ApiController) SetSessionClaims

func (c *ApiController) SetSessionClaims(claims *casdoorsdk.Claims)

func (*ApiController) SetSessionUser

func (c *ApiController) SetSessionUser(user *casdoorsdk.User)

func (*ApiController) Signin

func (c *ApiController) Signin()

func (*ApiController) Signout

func (c *ApiController) Signout()

func (*ApiController) StartSession

func (c *ApiController) StartSession()

func (*ApiController) StopSession

func (c *ApiController) StopSession()

func (*ApiController) TunnelMonitor

func (c *ApiController) TunnelMonitor()

func (*ApiController) UpdateAsset

func (c *ApiController) UpdateAsset()

UpdateAsset @Title UpdateAsset @Tag Asset API @Description update asset @Param id query string true "The id ( owner/name ) of the asset" @Param body body object.Asset true "The details of the asset" @Success 200 {object} controllers.Response The Response object @router /update-asset [post]

func (*ApiController) UpdateCommand added in v1.32.0

func (c *ApiController) UpdateCommand()

UpdateCommand @Title UpdateCommand @Tag Command API @Description update the command @Param id query string true "The id ( owner/name ) of the command" @Param command body object.Command true "The command object" @Success 200 {string} The Response object @router /update-command [post]

func (*ApiController) UpdateRecord

func (c *ApiController) UpdateRecord()

UpdateRecord @Title UpdateRecord @Tag Record API @Description update record @Param id query string true "The id ( owner/name ) of the record" @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /update-record [post]

func (*ApiController) UpdateSession

func (c *ApiController) UpdateSession()

UpdateSession @Title UpdateSession @Tag Session API @Description update session @Param id query string true "The id of session" @Param body body object.Session @Success 200 {object} Response @router /update-session [post]

type Cleaner added in v1.32.0

type Cleaner struct {
	// contains filtered or unexported fields
}

func NewCleaner added in v1.32.0

func NewCleaner(bufferSize int) *Cleaner

func (*Cleaner) AddData added in v1.32.0

func (c *Cleaner) AddData(data string)

func (*Cleaner) GetCleanedData added in v1.32.0

func (c *Cleaner) GetCleanedData() string

type GuacamoleHandler

type GuacamoleHandler struct {
	// contains filtered or unexported fields
}

func NewGuacamoleHandler

func NewGuacamoleHandler(ws *websocket.Conn, tunnel *guacamole.Tunnel) *GuacamoleHandler

func (GuacamoleHandler) Start

func (r GuacamoleHandler) Start()

func (GuacamoleHandler) Stop

func (r GuacamoleHandler) Stop()

type RefinedWriter added in v1.32.0

type RefinedWriter struct {
	context.Response
	// contains filtered or unexported fields
}

func (*RefinedWriter) String added in v1.32.0

func (w *RefinedWriter) String() string

func (*RefinedWriter) Write added in v1.32.0

func (w *RefinedWriter) Write(p []byte) (n int, err error)

type Response

type Response struct {
	Status string      `json:"status"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
	Data2  interface{} `json:"data2"`
}

Jump to

Keyboard shortcuts

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