httpx

package
v0.0.1-beta.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package httpx 构造共享的上游 HTTP 客户端(规格 §10.2 连接层参数)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(cfg TransportConfig) *http.Client

func NewTransport

func NewTransport(cfg TransportConfig) *http.Transport

Types

type TransportConfig

type TransportConfig struct {
	MaxIdleConns        int
	MaxIdleConnsPerHost int
	// MaxConnsPerHost 单 host 连接总数上限(含在用+空闲;0 = 不限)。
	// 网关既有 client 保持 0 不限(压测验证形态);SDK 适配层装配显式上界。
	MaxConnsPerHost int
	IdleConnTimeout time.Duration
	DialTimeout     time.Duration
	ForceHTTP2      bool
	// Proxy 上游请求代理函数(nil = 直连,默认)。不再隐式装配
	// http.ProxyFromEnvironment——HTTP_PROXY 设了会静默改道全部上游请求
	//(含 x-api-key/Authorization 凭据,WS 升级大概率失败),压测行为随
	// 环境漂移。装配方(main NewClient / SetTransport 两处)显式决定。
	Proxy func(*http.Request) (*url.URL, error)
}

Jump to

Keyboard shortcuts

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