remote

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecvResponse

func RecvResponse(r io.Reader, o interface{}) error

RecvResponse reads a response object from the given reader

func SendResponse

func SendResponse(o interface{}) error

SendResponse conveys to the caller a given response object o

Types

type ErrCantConnect

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

func (ErrCantConnect) Error

func (e ErrCantConnect) Error() string

func (ErrCantConnect) Unwrap

func (e ErrCantConnect) Unwrap() error

type LenReader

type LenReader interface {
	io.Reader
	Len() int
}

type Monitor

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

func NewMonitor

func NewMonitor(cmd *exec.Cmd, stdout LenReader, stderr LenReader) *Monitor

func (*Monitor) Kill

func (m *Monitor) Kill() error

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context) error

type MonitorClient

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

func NewMonitorClient

func NewMonitorClient(pid int) *MonitorClient

func (*MonitorClient) Kill

func (m *MonitorClient) Kill() error

func (*MonitorClient) Poll

func (m *MonitorClient) Poll() (*PollMessage, error)

func (*MonitorClient) Reap

func (m *MonitorClient) Reap() error

type MonitorServer

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

func NewMonitorServer

func NewMonitorServer(mon *Monitor) *MonitorServer

func (*MonitorServer) Serve

func (m *MonitorServer) Serve() error

func (*MonitorServer) Shutdown

func (m *MonitorServer) Shutdown() error

type PollMessage

type PollMessage struct {
	Stdout string `json:"stdout,omitempty"`
	Stderr string `json:"stderr,omitempty"`

	// ExitCode is non-nil when the controlled process exited
	ExitCode *int `json:"exitcode"`

	// Error is any error encountered while trying to reach the agent
	Error string `json:"error,omitempty"`
}

type PollReply

type PollReply struct {
	Stdout []byte
	Stderr []byte

	ExitCode int
	Alive    bool
}

type SafeBuffer

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

func (*SafeBuffer) Len

func (sb *SafeBuffer) Len() int

func (*SafeBuffer) Read

func (sb *SafeBuffer) Read(data []byte) (int, error)

func (*SafeBuffer) Write

func (sb *SafeBuffer) Write(data []byte) (int, error)

type SafeExitCode

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

SafeExitCode is a sync storage for the exit code of a process the initial value of nil cannot be reset after the first set

func (*SafeExitCode) Load

func (s *SafeExitCode) Load() *int

func (*SafeExitCode) Store

func (s *SafeExitCode) Store(code int)

type SafeSignal

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

SafeSignal is a goroutine safe signalling mechanism It can have multiple goroutines that trigger the signal without interfering with eachother (or crashing as using a channel would) Currently designed for a single waiter goroutine.

func (*SafeSignal) Signal

func (s *SafeSignal) Signal()

func (*SafeSignal) Wait

func (s *SafeSignal) Wait()

type StartMessage

type StartMessage struct {
	SessionID string `json:"sid"`
}

Jump to

Keyboard shortcuts

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