proxyconf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package proxyconf is the shared proxy settings object (C-03.FR-19, C-02.FR-22): whether a client uses a proxy of its own, its type, address and username, stored as `proxy jsonb`, and its password, a Secret stored beside it with the helper of internal/keyring. It validates an update and turns the stored object into the proxy of an outbound client (S-009). OIDC settings use it first; Connections, outgoing webhook Destinations and the outgoing heartbeat reuse it.

Index

Constants

View Source
const (
	TypeHTTP   = string(outbound.ProxyHTTP)
	TypeHTTPS  = string(outbound.ProxyHTTPS)
	TypeSOCKS5 = string(outbound.ProxySOCKS5)
)

The proxy types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled  bool    `json:"enabled"`
	Type     string  `json:"type,omitempty"`
	Address  string  `json:"address,omitempty"`
	Username *string `json:"username,omitempty"`
}

Config is the proxy object as stored in `proxy jsonb`, without its password. A disabled proxy may keep its type, address and username, so that switching it off and on again keeps them.

func Parse

func Parse(raw []byte) (Config, error)

Parse reads the stored object; an empty value is a disabled proxy.

func (Config) JSON

func (c Config) JSON() []byte

JSON is the object as stored.

func (Config) Outbound

func (c Config) Outbound(password logging.Secret) *outbound.Proxy

Outbound is the proxy of an outbound client for the stored object and its password: nil while it is disabled.

func (Config) Validate

func (c Config) Validate() error

Validate checks the object: the type is http, https or socks5 and the address is host:port with a port from 1 to 65535, both required while the proxy is enabled, and the username fits the SOCKS5 protocol.

type FieldError

type FieldError struct {
	Pointer string
	Code    string
	Detail  string
}

FieldError is a field of the proxy object that is not valid, at a JSON pointer relative to the object.

func (*FieldError) Error

func (e *FieldError) Error() string

type Input

type Input struct {
	Enabled     bool
	Type        *string
	Address     *string
	UsernameSet bool
	Username    *string
	Password    keyring.SecretInput
}

Input is the proxy object of an update: an omitted type, address or username keeps the stored one, a null username clears it, and the password follows the rule of every Secret field.

func (Input) Apply

func (in Input) Apply(stored Config) (Config, error)

Apply returns the stored object after in. An enabled proxy needs a type and an address of the form host:port.

Jump to

Keyboard shortcuts

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