Documentation
¶
Index ¶
- func CloseIdleConnections()
- func GetCloudFileClient2Min() *http.Client
- func NewBrowserRequest() (ret *req.Request)
- func NewCloudFileRequest2m() *req.Request
- func NewCloudRequest30s() *req.Request
- func NewTransport(skipTlsVerify bool) *http.Transport
- func NewUserAgentClient(base http.RoundTripper) *http.Client
- func NewUserAgentRoundTripper(base http.RoundTripper) http.RoundTripper
- func ProxyFromEnvironment(req *http.Request) (*url.URL, error)
- func SetUserAgent(siyuanUA string)
- type UserAgentTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseIdleConnections ¶
func CloseIdleConnections()
func GetCloudFileClient2Min ¶
func NewBrowserRequest ¶
func NewCloudFileRequest2m ¶
func NewCloudRequest30s ¶
func NewTransport ¶
func NewUserAgentClient ¶
func NewUserAgentClient(base http.RoundTripper) *http.Client
NewUserAgentClient 返回带 SiYuan UA 注入的 *http.Client。 base 为 nil 时用 NewTransport(false) 作底座。调用方可自行设置返回 client 的 Timeout。
func NewUserAgentRoundTripper ¶
func NewUserAgentRoundTripper(base http.RoundTripper) http.RoundTripper
NewUserAgentRoundTripper 返回带 SiYuan UA 注入的 RoundTripper。 base 为 nil 时回退到 http.DefaultTransport。适用于需要在 transport 层叠加自定义逻辑的场景(如 MCP 自定义 header)。
func SetUserAgent ¶
func SetUserAgent(siyuanUA string)
Types ¶
type UserAgentTransport ¶
type UserAgentTransport struct {
Base http.RoundTripper
}
UserAgentTransport 在出站请求上注入 SiYuan User-Agent,统一内核出网身份标识。 使用 Set 覆盖,会替换请求上已有的 UA(如 aws SDK 构造的含架构、Go 版本等的长 UA 串), 便于第三方服务端按 SiYuan/ 前缀稳定识别并加白名单。 Base 为底座 transport,负责实际的连接、代理、TLS 等配置。
Click to show internal directories.
Click to hide internal directories.