agh

package
v0.107.68 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package agh contains common entities and interfaces of AdGuard Home.

Index

Constants

View Source
const DefaultOutputLimit = 512

DefaultOutputLimit is the default limit of bytes for commands' standard output and standard error.

Variables

This section is empty.

Functions

func NewCommandConstructor added in v0.107.66

func NewCommandConstructor(
	_ string,
	code osutil.ExitCode,
	stdout string,
	cmdErr error,
) (cs executil.CommandConstructor)

NewCommandConstructor is a helper function that returns a mock executil.CommandConstructor for tests.

func NewMultipleCommandConstructor added in v0.107.66

func NewMultipleCommandConstructor(cmds ...ExternalCommand) (cs executil.CommandConstructor)

NewMultipleCommandConstructor is a helper function that returns a mock executil.CommandConstructor for tests that supports multiple commands.

TODO(s.chzhen): Move to aghtest once the import cycle is resolved, since it will be called from the aghnet package, which imports the whois package, which in turn imports aghnet.

Types

type ConfigModifier

type ConfigModifier interface {
	// Apply applies changes to the global configuration.
	Apply(ctx context.Context)
}

ConfigModifier defines an interface for updating the global configuration.

type EmptyConfigModifier

type EmptyConfigModifier struct{}

EmptyConfigModifier is an empty ConfigModifier implementation that does nothing.

func (EmptyConfigModifier) Apply

func (em EmptyConfigModifier) Apply(ctx context.Context)

Apply implements the ConfigModifier for EmptyConfigModifier.

type ExternalCommand added in v0.107.66

type ExternalCommand struct {
	// Err is the error returned, if non-nil.
	Err error

	// Cmd contains the command path and arguments.
	Cmd string

	// Out is written to stdout if non-empty.
	Out string

	// Code is returned as the exit code if non-zero.
	Code osutil.ExitCode
}

ExternalCommand is a fake command used by NewMultipleCommandConstructor.

Jump to

Keyboard shortcuts

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