socket

package
v0.0.0-...-9fb6cf1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONSOLE_CLEAR = iota // Represents a command to clear the console.
	CONSOLE_ERR          // Represents a console error.
	CONSOLE_EXIT         // Represents a command to exit the console.
)

Variables

View Source
var (
	// Format string for Unix socket session summary.
	UNIXSUMMARY = `
Session summary
Session ID: %s
All Socket Communications:
%s
Errors:
%s
`
	DEFAULT_LIMIT = 5                // Default limit for iterative operations.
	RCV_PAGESIZE  = 1024             // Default page size for receiving data.
	CONN_TIMEOUT  = time.Duration(2) // Default connection timeout duration.
	SOCKET_GET    = "get"
)
View Source
var (
	ERR_PATHNOTSOCKET = errors.New("file resource not a socket") // Error when the provided resource is not a socket.
)

Functions

func CreateSocketSubProc

func CreateSocketSubProc(name string) error

CreateSocketSubProc creates a socket for testing

func UnixSock

func UnixSock(ctx context.Context, url parser.Url, it bool) ([]byte, error)

UnixSock establishes a Unix socket connection and initiates a console session. It returns a summary of the session including any errors encountered.

Types

type Console

type Console struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Console represents a console session over a network connection.

func NewConsole

func NewConsole(ctx context.Context, conn net.Conn, url parser.Url, it bool) *Console

NewConsole creates a new Console instance with the given context, network connection, HTTP, and interactive mode flag.

func (*Console) Enter

func (c *Console) Enter() (sessID string, code int, communication [][]byte, err error)

Enter starts the console session and handles communication based on the interactive mode. It returns the session ID, exit code, communication log, and any error encountered.

func (*Console) Read

func (c *Console) Read(msg []byte) (int, error)

Read receives a message from the console's network connection.

func (*Console) Write

func (c *Console) Write(msg []byte) (int, error)

Write sends a message over the console's network connection.

type Creator

type Creator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCreator

func NewCreator() *Creator

func (*Creator) StartSocket

func (c *Creator) StartSocket(ctx context.Context, socketUpchan chan struct{}, errChan chan error)

type UUIDs

type UUIDs struct {
	List []string `json:"uuid_list"`
}

func (UUIDs) ByteSlice

func (u UUIDs) ByteSlice() (b [][]byte)

Jump to

Keyboard shortcuts

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