server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenericError        = 1
	NotImplementedError = 2
	BinaryNotFound      = 3
)
View Source
const (
	HelpProcessExecutionTimeout = 1 * time.Second
)

Variables

This section is empty.

Functions

func CastRequestPayload

func CastRequestPayload(payload interface{}, req interface{})

func GetErrorCode

func GetErrorCode(err error) int

func MarshalRequest

func MarshalRequest(req interface{}) (bytes []byte)

func MarshalResponse

func MarshalResponse(rsp interface{}, e error, warns []util.Warning) (bytes []byte)

func UnmarshalRequest

func UnmarshalRequest(data []byte) (name string, payload interface{}, err error)

func UnmarshalResponseToVar

func UnmarshalResponseToVar(data []byte, rsp interface{}) (err error, warns []util.Warning)

Types

type AddHelpPageRequest

type AddHelpPageRequest struct {
	Command datastore.Command
	Policy  datastore.Policy
}

type AddHelpPageResponse

type AddHelpPageResponse struct {
	HelpPage datastore.HelpPage
	Status   datastore.AddHelpPageStatus
}

type AttachRequest

type AttachRequest struct {
	Shell         string
	Pid           int
	CodBinaryPath string
}

type AttachResponse

type AttachResponse struct {
}

type Client

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

func NewClient

func NewClient(configuration Configuration) (client *Client, err error)

func (*Client) Close

func (c *Client) Close() (err error)

func (*Client) Request

func (c *Client) Request(req interface{}, rsp interface{}) (err error)

type CompleteWordsRequest

type CompleteWordsRequest struct {
	// First word of the `Words` must be executable path.
	Words []string
	CWord int
}

type CompleteWordsResponse

type CompleteWordsResponse struct {
	Completions []string
}

type Configuration

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

func DefaultConfiguration

func DefaultConfiguration() (cfg Configuration, err error)

func (*Configuration) GetCompletionConfigDir

func (cfg *Configuration) GetCompletionConfigDir() string

func (*Configuration) GetCompletionDbDir

func (cfg *Configuration) GetCompletionDbDir() string

func (*Configuration) GetCompletionsSqliteDb

func (cfg *Configuration) GetCompletionsSqliteDb() string

func (*Configuration) GetHomeDir

func (cfg *Configuration) GetHomeDir() string

func (*Configuration) GetKnownCommandsFile

func (cfg *Configuration) GetKnownCommandsFile() string

func (*Configuration) GetLearnBlacklistFile

func (cfg *Configuration) GetLearnBlacklistFile() string

func (*Configuration) GetLockFile

func (cfg *Configuration) GetLockFile() string

func (*Configuration) GetLogDir

func (cfg *Configuration) GetLogDir() string

func (*Configuration) GetPidFile

func (cfg *Configuration) GetPidFile() string

func (*Configuration) GetRunDir

func (cfg *Configuration) GetRunDir() string

func (*Configuration) GetSocketFile

func (cfg *Configuration) GetSocketFile() string

func (*Configuration) GetUserConfiguration

func (cfg *Configuration) GetUserConfiguration() string

type DetachRequest

type DetachRequest struct {
	Pid int
}

type DetachResponse

type DetachResponse struct {
}

type ErrorResponse

type ErrorResponse struct {
	Code int
	Desc string
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type InitScriptRequest

type InitScriptRequest struct {
	Pid int
}

type InitScriptResponse

type InitScriptResponse struct {
	Script []string
}

type ListClientsRequest

type ListClientsRequest struct {
}

type ListClientsResponse

type ListClientsResponse struct {
	Clients []ShellAndPid
}

type ListCommandsRequest

type ListCommandsRequest struct {
	Selectors []string
}

type ListCommandsResponse

type ListCommandsResponse struct {
	CommandItems []ListCommandsResponseItem
}

type ListCommandsResponseItem

type ListCommandsResponseItem struct {
	Id int64

	// In rare cases Command might be empty.
	Command *datastore.Command
}

type ParseCommandLineRequest

type ParseCommandLineRequest struct {
	Pid         int
	CommandLine string
	Dir         string
	Env         []string
}

type ParseCommandLineResponse

type ParseCommandLineResponse struct {
	IsHelpCommand bool
	PolicyMode    datastore.Policy
	Args          []string
	Env           []string
}

type PollUpdatesRequest

type PollUpdatesRequest struct {
	Pid int
}

type PollUpdatesResponse

type PollUpdatesResponse struct {
	Script []string
}

type RemoteError

type RemoteError struct {
	Code    int
	Message string
}

func (RemoteError) Error

func (e RemoteError) Error() string

type RemoveCommandsRequest

type RemoveCommandsRequest struct {
	HelpPageIds []int64
}

type RemoveCommandsResponse

type RemoveCommandsResponse struct {
}

type Rule

type Rule struct {
	Executable string `toml:"executable"`

	Policy datastore.Policy `toml:"policy"`
	// contains filtered or unexported fields
}

type Server

type Server interface {
	Serve() error
	Close() error
}

func NewServer

func NewServer(cfg *Configuration) (server Server, err error)

type ShellAndPid

type ShellAndPid struct {
	Shell string
	Pid   int
}

type UpdateHelpPageRequest

type UpdateHelpPageRequest struct {
	Id      int64
	Command datastore.Command
}

type UpdateHelpPageResponse

type UpdateHelpPageResponse struct {
}

type UserConfiguration

type UserConfiguration struct {
	Rules []Rule `toml:"rule"`
}

func LoadUserConfiguration

func LoadUserConfiguration(filename, homeDir string) (userConfiguration UserConfiguration, err error)

func LoadUserConfigurationFromBytes

func LoadUserConfigurationFromBytes(bytes []byte, homeDir string) (userConfiguration UserConfiguration, err error)

func (*UserConfiguration) GetExecutablePolicy

func (cfg *UserConfiguration) GetExecutablePolicy(executablePath string) datastore.Policy

Jump to

Keyboard shortcuts

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