useragent

package
v0.67.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package useragent sets the vMCP User-Agent on requests vMCP sends to its backends, so backend proxies can attribute those requests to vMCP instead of seeing Go's default Go-http-client agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Value

func Value() string

Value returns the User-Agent vMCP sends to backends.

Types

type RoundTripper

type RoundTripper struct {
	// contains filtered or unexported fields
}

RoundTripper sets the vMCP User-Agent on requests that carry none.

A User-Agent already on the request is kept. Place this stage inside (closer to the wire than) the header-forward stage so a User-Agent an operator forwards through passthroughHeaders or headerForward reaches the backend unchanged.

func NewRoundTripper

func NewRoundTripper(base http.RoundTripper) *RoundTripper

NewRoundTripper wraps base with a stage that sets the vMCP User-Agent.

func (*RoundTripper) CloseIdleConnections

func (t *RoundTripper) CloseIdleConnections()

CloseIdleConnections forwards to the wrapped RoundTripper so it reaches the concrete *http.Transport at the bottom of the chain.

func (*RoundTripper) RoundTrip

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

RoundTrip implements http.RoundTripper. It clones the request before setting the header, per the RoundTripper contract.

Jump to

Keyboard shortcuts

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