useragent

package
v1.63.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 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 useragent centralizes the HTTP identity headers that built-in tools (api, fetch, openapi, ...) attach to every outbound request.

Index

Constants

View Source
const (
	HeaderAgentVersion   = "X-Docker-Agent-Version"
	HeaderDesktopVersion = "X-Docker-Desktop-Version"
)

HTTP header names emitted by SetIdentity in addition to User-Agent.

Variables

View Source
var Header = fmt.Sprintf("Cagent/%s (%s; %s)", version.Version, runtime.GOOS, runtime.GOARCH)

Header is the User-Agent value sent by built-in HTTP tools. It also doubles as the agent name fed to robotstxt.RobotsData.TestAgent so site operators see the same identity in both places.

Functions

func SetIdentity added in v1.60.0

func SetIdentity(req *http.Request)

SetIdentity stamps the request with User-Agent, X-Docker-Agent-Version, and (when Docker Desktop is reachable) X-Docker-Desktop-Version. Callers that want operator-supplied overrides should apply those headers AFTER calling SetIdentity.

Types

This section is empty.

Jump to

Keyboard shortcuts

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