socket

package
v0.0.0-...-e67f76d Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnHost = "localhost"
	ConnType = "tcp"
)

const for connection

View Source
const (
	SignalConnect Signal = "SIGNAL_CONNECT"
	SignalExec           = "SIGNAL_EXEC"
	SignalSuccess        = "SIGNAL_SUCCESS"
	SignalError          = "SIGNAL_ERROR"
)

const for signal type

View Source
const (
	ExecSet ExecType = "EXEC_SET"
	ExecGet          = "EXEC_GET"
	ExecDel          = "EXEC_DEL"
)

const for execution types

Variables

This section is empty.

Functions

func CommandHeadersToMessage

func CommandHeadersToMessage(headers CommandHeader) string

CommandHeadersToMessage returns message built from given headers

func CommandToMessage

func CommandToMessage(command *Command) string

CommandToMessage generate message string from given command

Types

type Command

type Command struct {
	Type    Signal
	User    string
	Payload string
	Headers CommandHeader
}

Command struct for client and server data

func NewCommandFromMessage

func NewCommandFromMessage(message string) *Command

NewCommandFromMessage create command from message string message format: cmd=>uid=>payload=>header

type CommandHeader

type CommandHeader map[string]interface{}

CommandHeader type

func NewCommandHeadersFromMessage

func NewCommandHeadersFromMessage(message string) CommandHeader

NewCommandHeadersFromMessage create command header from given message the message should: EXEC_TYPE:<ExecType>

type Exec

type Exec struct {
	Type ExecType
	Args []string
}

Exec define execution model

func NewExecFromCommandPayload

func NewExecFromCommandPayload(payload string) *Exec

NewExecFromCommandPayload create exec using command payload

type ExecType

type ExecType string

ExecType type of execution command

const (
	CommandHeaderExecType ExecType = "EXEC_TYPE"
)

const for command header

type Signal

type Signal string

Signal type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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