egress

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 12 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 egress is ynf's allow-list proxy (ADR-007). A contained run's only route out is through it: HTTPS by CONNECT and plain HTTP by forwarding, each to a host the lane allows. Every request, allowed or denied, is logged as one JSON line, so a run that needed a host the lane does not allow says exactly which, and the denial becomes a failure signature (ADR-008).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allowed

func Allowed(allow []string, host string) bool

Allowed reports whether host matches the allow list. An entry is a host name, or "*.example.com" for any subdomain of example.com (not example.com itself).

func Denied

func Denied(path string) ([]string, error)

Denied reads a log written by the proxy and returns the hosts it denied, sorted and unique. A missing log means the run never used the proxy.

Types

type Entry

type Entry struct {
	Time    time.Time `json:"time"`
	Method  string    `json:"method"`
	Host    string    `json:"host"`
	Port    string    `json:"port"`
	Allowed bool      `json:"allowed"`
	Error   string    `json:"error,omitempty"`
}

Entry is one logged request.

type Proxy

type Proxy struct {
	Allow []string
	Log   io.Writer
	Dial  func(network, addr string) (net.Conn, error) // default net.DialTimeout with 10s
	// contains filtered or unexported fields
}

Proxy is the allow-list proxy.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

Jump to

Keyboard shortcuts

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