Help us shape the future of Go! Take the 2026 Go Developer Survey

nexusclient

package
v1.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResponseTooLarge = errors.New("Nexus response exceeds configured limit")

Functions

func ReadBoundedBody

func ReadBoundedBody(reader io.Reader, maxBytes int64) ([]byte, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 只负责 AgentDock 到已配对 NexusDock 的通用 HTTP 传输策略。 领域路径、超时、响应结构和错误语义继续由调用方拥有。

func New

func New(endpoint, token string) Client

func NewWithTransport added in v1.1.0

func NewWithTransport(endpoint, token string, transport http.RoundTripper) Client

NewWithTransport 只替换这一次调用的传输层。 传 nil 时与 New 相同,仍使用默认 Transport,包括系统环境代理。 资源库的固定拨号通过这里接入,避免改掉其他 Nexus HTTP 调用的行为。

func (Client) Do

func (c Client) Do(ctx context.Context, method, path string, body []byte) (*http.Response, error)

func (Client) DoStream added in v1.1.0

func (c Client) DoStream(ctx context.Context, method, path, contentType string, body io.Reader, contentLength int64) (*http.Response, error)

DoStream 按调用方给出的长度发送正文,不把正文读进内存。 Content-Length 固定为 contentLength,避免大 ZIP 被改成 chunked,也避免 Device Token 请求在重定向前被缓冲。

func (Client) Endpoint

func (c Client) Endpoint() string

Jump to

Keyboard shortcuts

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