Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
// Package httpx is the single funnel for outbound HTTP from the daemon.
|
|
// Every client it hands out resolves proxies per request with the same
|
|
// precedence spawned agents get (explicit env > macOS system proxy > direct,
|
|
// NO_PROXY and loopback always bypass — see runtimecmd.DynamicProxyFunc).
|
|
//
|
|
// Direct use of http.DefaultClient / bare http.Client literals is rejected by
|
|
// lint (forbidigo + tools/scripts/check-http-client-funnel.mjs) so requests
|
|
// cannot silently bypass the proxy policy again.
|
|
package httpx
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/tutti-os/tutti/packages/agent/daemon/runtimecmd"
|
|
)
|
|
|
|
// NewTransport clones the default transport and makes it proxy-aware.
|
|
func NewTransport() *http.Transport {
|
|
transport := http.DefaultTransport.(*http.Transport).Clone()
|
|
transport.Proxy = runtimecmd.DynamicProxyFunc()
|
|
return transport
|
|
}
|
|
|
|
// NewClient returns a proxy-aware client with the given total-request timeout.
|
|
func NewClient(timeout time.Duration) *http.Client {
|
|
return &http.Client{Transport: NewTransport(), Timeout: timeout}
|
|
}
|
|
|
|
var defaultClient = &http.Client{Transport: NewTransport()}
|
|
|
|
// Default returns the shared proxy-aware client. It sets no timeout; bound
|
|
// requests with a context.
|
|
func Default() *http.Client {
|
|
return defaultClient
|
|
}
|