Sample
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4: httpproxy.Config, httpproxy.FromEnvironment
Verified sample for golang golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4: httpproxy.Config, httpproxy.FromEnvironment. The contract ran on go 1.26 …
sha256:55c87f7c17d9fe8ebda55ce4b34abd5f4c8cbba311f14280329d6dce2f3f2c13
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-10-12 |
Case
HOW- Goal
- verify pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4
- Symbols
-
- golang.org/x/net/http/httpproxy.Config
- golang.org/x/net/http/httpproxy.FromEnvironment
- Created
- 2026-10-12T09:27:12Z
Contract
- httpproxy.Config.ProxyFunc routes HTTP and HTTPS URLs to configured proxy endpoints while bypassing destinations matching NoProxy patterns
- httpproxy.FromEnvironment initializes proxy configuration from HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:9c48957fb87105973936e5ec2b61331f5a5c2523068bded2ad60ab0fd3033eda","contract":["httpproxy.Config.ProxyFunc routes HTTP and HTTPS URLs to configured proxy endpoints while bypassing destinations matching NoProxy patterns","httpproxy.FromEnvironment initializes proxy configuration from HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables"],"goal":"verify pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4"],"schemaVersion":1,"symbols":["golang.org/x/net/http/httpproxy.Config","golang.org/x/net/http/httpproxy.FromEnvironment"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4","symbols":["golang.org/x/net/http/httpproxy.Config","golang.org/x/net/http/httpproxy.FromEnvironment"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.25.0
require golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
require golang.org/x/text v0.3.3 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
package main
import (
"fmt"
"log"
"net/url"
"golang.org/x/net/http/httpproxy"
)
func main() {
cfg := &httpproxy.Config{
HTTPProxy: "http://proxy.example.com:8080",
HTTPSProxy: "https://secure-proxy.example.com:8443",
NoProxy: "localhost,127.0.0.1,.internal.example.com",
}
proxyFunc := cfg.ProxyFunc()
targetURL, err := url.Parse("http://api.example.com/data")
if err != nil {
log.Fatalf("failed to parse url: %v", err)
}
proxyURL, err := proxyFunc(targetURL)
if err != nil {
log.Fatalf("failed to determine proxy: %v", err)
}
if proxyURL != nil {
fmt.Printf("Routing %s via proxy: %s\n", targetURL, proxyURL)
} else {
fmt.Printf("Routing %s directly (no proxy)\n", targetURL)
}
envCfg := httpproxy.FromEnvironment()
fmt.Printf("Environment proxy configured: HTTP=%q, HTTPS=%q, NO_PROXY=%q\n",
envCfg.HTTPProxy, envCfg.HTTPSProxy, envCfg.NoProxy)
fmt.Println("golang.org/x/net/http/httpproxy sample completed successfully")
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/net@v0.0.0-20210405180319-a5a99cb37ef4"
]
}
package main
import (
"fmt"
"net/url"
"os"
"golang.org/x/net/http/httpproxy"
)
func main() {
// Assertion 1: httpproxy.Config.ProxyFunc routes HTTP and HTTPS URLs to configured proxy endpoints while bypassing destinations matching NoProxy patterns
{
cfg := &httpproxy.Config{
HTTPProxy: "http://proxy.example.com:8080",
HTTPSProxy: "https://secure-proxy.example.com:8443",
NoProxy: "localhost,127.0.0.1,.internal.example.com,bypass.example.org",
}
proxyFunc := cfg.ProxyFunc()
testCases := []struct {
rawURL string
wantProxy string
shouldSkip bool
}{
{"http://api.example.com/items", "http://proxy.example.com:8080", false},
{"https://secure.example.com/items", "https://secure-proxy.example.com:8443", false},
{"http://service.internal.example.com/health", "", true},
{"https://bypass.example.org/status", "", true},
{"http://localhost:8080/test", "", true},
{"http://127.0.0.1:9090/metrics", "", true},
}
for _, tc := range testCases {
reqURL, err := url.Parse(tc.rawURL)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: could not parse url %s: %v\n", tc.rawURL, err)
os.Exit(1)
}
proxyURL, err := proxyFunc(reqURL)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: proxyFunc error for %s: %v\n", tc.rawURL, err)
os.Exit(1)
}
if tc.shouldSkip {
if proxyURL != nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: expected no proxy for %s, got %s\n", tc.rawURL, proxyURL.String())
os.Exit(1)
}
} else {
if proxyURL == nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: expected proxy %s for %s, got nil\n", tc.wantProxy, tc.rawURL)
os.Exit(1)
}
if proxyURL.String() != tc.wantProxy {
fmt.Fprintf(os.Stderr, "assertion 1 failed: expected proxy %s for %s, got %s\n", tc.wantProxy, tc.rawURL, proxyURL.String())
os.Exit(1)
}
}
}
}
// Assertion 2: httpproxy.FromEnvironment initializes proxy configuration from HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables
{
os.Setenv("HTTP_PROXY", "http://env-proxy.example.com:3128")
os.Setenv("HTTPS_PROXY", "https://env-secure.example.com:3129")
os.Setenv("NO_PROXY", "local.example.com")
defer func() {
os.Unsetenv("HTTP_PROXY")
os.Unsetenv("HTTPS_PROXY")
os.Unsetenv("NO_PROXY")
}()
envCfg := httpproxy.FromEnvironment()
if envCfg.HTTPProxy != "http://env-proxy.example.com:3128" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected HTTPProxy %q, got %q\n", "http://env-proxy.example.com:3128", envCfg.HTTPProxy)
os.Exit(1)
}
if envCfg.HTTPSProxy != "https://env-secure.example.com:3129" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected HTTPSProxy %q, got %q\n", "https://env-secure.example.com:3129", envCfg.HTTPSProxy)
os.Exit(1)
}
if envCfg.NoProxy != "local.example.com" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected NoProxy %q, got %q\n", "local.example.com", envCfg.NoProxy)
os.Exit(1)
}
proxyFunc := envCfg.ProxyFunc()
uBypass, err := url.Parse("http://local.example.com/api")
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: url parse error: %v\n", err)
os.Exit(1)
}
pBypass, err := proxyFunc(uBypass)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: env proxyFunc error: %v\n", err)
os.Exit(1)
}
if pBypass != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected bypass for local.example.com, got %s\n", pBypass.String())
os.Exit(1)
}
uProxy, err := url.Parse("http://external.example.com/api")
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: url parse error: %v\n", err)
os.Exit(1)
}
pProxy, err := proxyFunc(uProxy)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: env proxyFunc error: %v\n", err)
os.Exit(1)
}
if pProxy == nil || pProxy.String() != "http://env-proxy.example.com:3128" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected proxy %q, got %v\n", "http://env-proxy.example.com:3128", pProxy)
os.Exit(1)
}
}
fmt.Println("All contract assertions passed.")
}
Origin Seeder
anonymous