diragent

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package diragent implements the client part of the directory agent protocol. It handles connecting to the server via websocket, authentication, and relaying messages from the server to a child process (implemented by RunWorker) and back.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunWorker

func RunWorker(ctx context.Context, provider directory.Provider) error

RunWorker implements the worker process for a directory agent. It handles accepting and processing requests from the server. It returns when ctx is canceled or when the parent closes stdin.

func SelfArgv added in v0.1.28

func SelfArgv() ([]string, error)

SelfArgv returns the absolute path of the current executable followed by its original command-line arguments. The result can be passed to exec.Command to start the same command directly, without a shell or executable-path lookup.

Types

type Service

type Service struct {
	Server    string
	AuthToken string
	DirID     string

	// Command starts the worker through the platform shell: cmd.exe /c on Windows
	// or /bin/sh -c elsewhere. Use it for operator-supplied commands that may contain
	// shell syntax. It is ignored when Argv is non-empty.
	Command string

	// Argv starts the worker directly without a shell. Argv[0] is the executable
	// and the remaining elements are passed as individual arguments. Use it for
	// programmatically constructed invocations so argument boundaries are preserved.
	// Argv takes precedence over Command.
	Argv []string

	Env        map[string]string
	Stderr     io.Writer
	HTTPClient *http.Client
	Verbose    bool
	// contains filtered or unexported fields
}

Service runs the parent process for the directory agent. It connects to the server and relays messages between the server (via websocket) and the child process (via stdin/stdout).

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Run runs the directory agent service. It connects to the server and relays messages. If the connection fails, it retries. It returns when the parent context is canceled or the worker process exits.

Jump to

Keyboard shortcuts

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