| 1234567891011121314151617181920 |
- package proxy
- import (
- "context"
- "github.com/docker/api/client"
- )
- type clientKey struct{}
- // WithClient adds the client to the context
- func WithClient(ctx context.Context, c *client.Client) (context.Context, error) {
- return context.WithValue(ctx, clientKey{}, c), nil
- }
- // Client returns the client from the context
- func Client(ctx context.Context) *client.Client {
- c, _ := ctx.Value(clientKey{}).(*client.Client)
- return c
- }
|