useragent

package
v0.5.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: PostgreSQL Imports: 3 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 useragent names the CLI to the APIs it calls, so server-side analytics can tell its traffic apart from the console's and from other Go clients, which all send Go's default Go-http-client/1.1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(version string) string

String is the User-Agent for a build of the given version, such as "pgedge-cli/0.5.0 (darwin; arm64)".

func Wrap

func Wrap(base http.RoundTripper, ua string) http.RoundTripper

Wrap returns base wrapped so every request carries ua. An empty ua returns base itself, as a test Runtime has none.

Types

type Transport

type Transport struct {
	Base      http.RoundTripper
	UserAgent string
}

Transport sets the User-Agent header. Use Wrap.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip sets the header on a clone, since a RoundTripper must not modify the caller's request.

Jump to

Keyboard shortcuts

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