Documentation
¶
Index ¶
- Constants
- func BuildLogsURL(appID string) string
- func Endpoint(ctx context.Context, apiClient client.APIClient) (string, error)
- func IsFeatureActive(ctx context.Context, apiClient client.APIClient, feature string) bool
- func IsFeatureActiveStandalone(ctx context.Context, feature string) bool
- func ProxyTransport(endpoint string) http.RoundTripper
- func ProxyTransportFor(ctx context.Context, apiClient client.APIClient) http.RoundTripper
- type Client
- type FeatureFlagResponse
- type FeatureFlagValue
- type PingResponse
Constants ¶
const EngineLabel = "com.docker.desktop.address"
EngineLabel is used to detect that Compose is running with a Docker Desktop context. When present, the value is an endpoint address for an in-memory socket (AF_UNIX or named pipe).
const FeatureLogsTab = "LogsTab"
FeatureLogsTab is the feature flag name for the Docker Desktop Logs view.
const LogsAppIDMaxLen = 256
LogsAppIDMaxLen mirrors the byte-length cap Docker Desktop's URL handler applies to the appId query parameter; values longer than this are truncated by the receiver, so we trim ahead of time to avoid emitting hyperlinks that will be silently shortened. The slice in BuildLogsURL is a byte slice — Compose project names are restricted to the ASCII set `[a-z0-9_-]` by loader.NormalizeProjectName, so a byte cap and a rune cap coincide for any value that could legitimately reach this builder.
Variables ¶
This section is empty.
Functions ¶
func BuildLogsURL ¶ added in v5.1.4
BuildLogsURL returns the deep link that opens Docker Desktop's Logs view, optionally pre-filtered to a Compose project. An empty appID yields the unfiltered URL.
func Endpoint ¶ added in v5.1.4
Endpoint returns the Docker Desktop API socket endpoint advertised via the engine info labels, or "" when the active engine is not Docker Desktop.
func IsFeatureActive ¶ added in v5.1.4
IsFeatureActive reports whether Docker Desktop is the active engine and the given feature flag is enabled. Returns false silently on any failure — the engine being unreachable, Desktop not being the active engine, or the flag being off — so callers can use this as a single gating check.
func IsFeatureActiveStandalone ¶ added in v5.1.4
IsFeatureActiveStandalone is the convenience form of IsFeatureActive for callers without an existing engine API client (e.g. the compose plugin hook subprocess). It builds a Docker CLI using the ambient environment to resolve the active context, then delegates to IsFeatureActive.
func ProxyTransport ¶ added in v5.1.4
func ProxyTransport(endpoint string) http.RoundTripper
ProxyTransport returns an http.RoundTripper that routes traffic through Docker Desktop's PAC-aware HTTP proxy when DD exposes the proxy socket, or nil when no override is needed (callers should use their own default transport in that case — for the OCI resolver this means containerd's built-in transport). Pass "" for endpoint when DD is not the active engine.
When DD is available, the returned transport is a clone of http.DefaultTransport with only Proxy and DialContext overridden, so it preserves stdlib timeout, pooling, and HTTP/2 defaults.
func ProxyTransportFor ¶ added in v5.1.4
ProxyTransportFor discovers the Docker Desktop endpoint via apiClient and returns the matching transport, or nil when DD is not active or discovery fails (so callers fall back to their own default transport).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for integration with Docker Desktop features.
func NewClient ¶
NewClient creates a Desktop integration client for the provided in-memory socket address (AF_UNIX or named pipe).
func (*Client) FeatureFlags ¶
func (c *Client) FeatureFlags(ctx context.Context) (FeatureFlagResponse, error)
func (*Client) IsFeatureEnabled ¶ added in v5.1.3
IsFeatureEnabled checks the feature flag (GET /features) for a given feature. Returns true when the feature is rolled out.
type FeatureFlagResponse ¶
type FeatureFlagResponse map[string]FeatureFlagValue
type FeatureFlagValue ¶
type FeatureFlagValue struct {
Enabled bool `json:"enabled"`
}
type PingResponse ¶
type PingResponse struct {
ServerTime int64 `json:"serverTime"`
}