escapeguard

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.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 escapeguard is the Escape guard (see CONTEXT.md): a proxy that OpenTofu and gcloud runs in the acceptance tests go through, so that an Escaped request fails the test, naming the host, instead of reaching Google.

The guard refuses every request; it never forwards one. A client reaches it through HTTPS_PROXY and HTTP_PROXY (Env). Requests to the API gateway bypass it: Go never proxies loopback addresses, and NO_PROXY exempts them for clients such as gcloud that otherwise would. The guard only sees traffic that would leave the machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Describe

func Describe(host string) string

Describe explains why a request from OpenTofu to host escaped.

func DescribeGcloud

func DescribeGcloud(host string) string

DescribeGcloud explains why a request from gcloud to host escaped: gcloud sends an API without a CLOUDSDK_API_ENDPOINT_OVERRIDES_<API> to <api>.gcpemu.invalid, or to <api>.googleapis.com outside the Invalid universe.

func Gcloud

func Gcloud(hosts []string) []string

Gcloud drops from hosts, as Take returns them, the ones gcloud reaches in the Invalid universe without escaping: its universe descriptor fetch. Only gcloud's hosts may be filtered: from OpenTofu, the same host is a storage API with no *_custom_endpoint.

Types

type Guard

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

Guard is a running Escape guard.

func New

func New(t testing.TB) *Guard

New starts a guard on a loopback port and stops it when t ends.

func (*Guard) Env

func (g *Guard) Env() []string

Env returns the variables that send a client's outbound requests to the guard. They override any proxy set in the environment, and set NO_PROXY so that only loopback is exempt.

func (*Guard) Take

func (g *Guard) Take() []string

Take returns the hosts refused since the last call.

Jump to

Keyboard shortcuts

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