Help us shape the future of Go! Take the 2026 Go Developer Survey

useragent

package
v1.145.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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