NewClient creates a Desktop integration client for the provided in-memory socket address (AF_UNIX or named pipe).
(apiEndpoint string)
| 80 | // NewClient creates a Desktop integration client for the provided in-memory |
| 81 | // socket address (AF_UNIX or named pipe). |
| 82 | func NewClient(apiEndpoint string) *Client { |
| 83 | var transport http.RoundTripper = &http.Transport{ |
| 84 | DisableCompression: true, |
| 85 | DialContext: func(ctx context.Context, _, _ string) (net.Conn, error) { |
| 86 | return memnet.DialEndpoint(ctx, apiEndpoint) |
| 87 | }, |
| 88 | } |
| 89 | transport = otelhttp.NewTransport(transport) |
| 90 | |
| 91 | return &Client{ |
| 92 | apiEndpoint: apiEndpoint, |
| 93 | client: &http.Client{Transport: transport}, |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func (c *Client) Endpoint() string { |
| 98 | return c.apiEndpoint |