catchrpc

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrParseError     = -32700
	ErrInvalidRequest = -32600
	ErrMethodNotFound = -32601
	ErrInvalidParams  = -32602
	ErrInternal       = -32603
)
View Source
const (
	ExecMsgResize     = "resize"
	ExecMsgStdinClose = "stdin-close"
	ExecMsgExit       = "exit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactHash

type ArtifactHash struct {
	Kind   string `json:"kind,omitempty"`
	SHA256 string `json:"sha256,omitempty"`
}

type ArtifactHashesRequest

type ArtifactHashesRequest struct {
	Service string `json:"service"`
}

type ArtifactHashesResponse

type ArtifactHashesResponse struct {
	Found   bool          `json:"found"`
	Message string        `json:"message,omitempty"`
	Payload *ArtifactHash `json:"payload,omitempty"`
	Env     *ArtifactHash `json:"env,omitempty"`
}

type Client

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

func NewClient

func NewClient(host string, port int) *Client

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params any, out any) error

func (*Client) Events

func (c *Client) Events(ctx context.Context, req EventsRequest, onEvent func(Event)) error

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, req ExecRequest, stdin io.Reader, stdout io.Writer, resizeCh <-chan Resize) (int, error)

func (*Client) ServiceInfo

func (c *Client) ServiceInfo(ctx context.Context, service string) (ServiceInfoResponse, error)

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

type Event

type Event struct {
	Time        int64  `json:"time"`
	ServiceName string `json:"serviceName"`
	Type        string `json:"type"`
	Data        any    `json:"data,omitempty"`
}

type EventsRequest

type EventsRequest struct {
	Service string `json:"service,omitempty"`
	All     bool   `json:"all,omitempty"`
}

type ExecMessage

type ExecMessage struct {
	Type  string `json:"type"`
	Rows  int    `json:"rows,omitempty"`
	Cols  int    `json:"cols,omitempty"`
	Code  int    `json:"code,omitempty"`
	Error string `json:"error,omitempty"`
}

type ExecRequest

type ExecRequest struct {
	Service     string       `json:"service"`
	Host        string       `json:"host,omitempty"`
	User        string       `json:"user,omitempty"`
	Args        []string     `json:"args"`
	PayloadName string       `json:"payloadName,omitempty"`
	TTY         bool         `json:"tty"`
	Progress    ProgressMode `json:"progress,omitempty"`
	Term        string       `json:"term,omitempty"`
	Rows        int          `json:"rows,omitempty"`
	Cols        int          `json:"cols,omitempty"`
}

type ProgressMode

type ProgressMode string
const (
	ProgressAuto  ProgressMode = "auto"
	ProgressTTY   ProgressMode = "tty"
	ProgressPlain ProgressMode = "plain"
	ProgressQuiet ProgressMode = "quiet"
)

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type Resize

type Resize struct {
	Rows int
	Cols int
}

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Result  any             `json:"result,omitempty"`
	Error   *Error          `json:"error,omitempty"`
}

type ServiceComponentStatus

type ServiceComponentStatus struct {
	Name   string `json:"name,omitempty"`
	Status string `json:"status,omitempty"`
}

type ServiceIP

type ServiceIP struct {
	Label     string `json:"label,omitempty"`
	IP        string `json:"ip,omitempty"`
	Interface string `json:"interface,omitempty"`
}

type ServiceImage

type ServiceImage struct {
	Repo string                     `json:"repo"`
	Refs map[string]ServiceImageRef `json:"refs,omitempty"`
}

type ServiceImageRef

type ServiceImageRef struct {
	Digest    string `json:"digest,omitempty"`
	MediaType string `json:"mediaType,omitempty"`
}

type ServiceInfo

type ServiceInfo struct {
	Name             string         `json:"name"`
	ServiceType      string         `json:"serviceType,omitempty"`
	DataType         string         `json:"dataType,omitempty"`
	Generation       int            `json:"generation,omitempty"`
	LatestGeneration int            `json:"latestGeneration,omitempty"`
	Staged           bool           `json:"staged,omitempty"`
	Paths            ServicePaths   `json:"paths,omitempty"`
	Network          ServiceNetwork `json:"network,omitempty"`
	Status           ServiceStatus  `json:"status,omitempty"`
	Images           []ServiceImage `json:"images,omitempty"`
}

type ServiceInfoRequest

type ServiceInfoRequest struct {
	Service string `json:"service"`
}

type ServiceInfoResponse

type ServiceInfoResponse struct {
	Found   bool        `json:"found"`
	Message string      `json:"message,omitempty"`
	Info    ServiceInfo `json:"info,omitempty"`
}

type ServiceMacvlan

type ServiceMacvlan struct {
	Interface string `json:"interface,omitempty"`
	Parent    string `json:"parent,omitempty"`
	Mac       string `json:"mac,omitempty"`
	VLAN      int    `json:"vlan,omitempty"`
}

type ServiceNetwork

type ServiceNetwork struct {
	SvcIP     string            `json:"svcIp,omitempty"`
	IPs       []ServiceIP       `json:"ips,omitempty"`
	IPError   string            `json:"ipError,omitempty"`
	Macvlan   *ServiceMacvlan   `json:"macvlan,omitempty"`
	Tailscale *ServiceTailscale `json:"tailscale,omitempty"`
}

type ServicePaths

type ServicePaths struct {
	Root string `json:"root,omitempty"`
}

type ServiceStatus

type ServiceStatus struct {
	Components []ServiceComponentStatus `json:"components,omitempty"`
	Error      string                   `json:"error,omitempty"`
}

type ServiceTailscale

type ServiceTailscale struct {
	Interface string   `json:"interface,omitempty"`
	Version   string   `json:"version,omitempty"`
	ExitNode  string   `json:"exitNode,omitempty"`
	Tags      []string `json:"tags,omitempty"`
	StableID  string   `json:"stableId,omitempty"`
}

type TailscaleSetupRequest

type TailscaleSetupRequest struct {
	ClientSecret string `json:"clientSecret"`
}

type TailscaleSetupResponse

type TailscaleSetupResponse struct {
	Path     string `json:"path"`
	Verified bool   `json:"verified"`
}

Jump to

Keyboard shortcuts

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