mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: define separate interface for HijackDialer
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
// Example:
|
||||
//
|
||||
// bkclient.New(ctx, "", ClientOpts(c)...)
|
||||
func ClientOpts(c client.CommonAPIClient) []bkclient.ClientOpt {
|
||||
func ClientOpts(c client.HijackDialer) []bkclient.ClientOpt {
|
||||
return []bkclient.ClientOpt{
|
||||
bkclient.WithSessionDialer(func(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error) {
|
||||
return c.DialHijack(ctx, "/session", proto, meta)
|
||||
|
||||
@@ -39,11 +39,16 @@ type CommonAPIClient interface {
|
||||
ServerVersion(ctx context.Context) (types.Version, error)
|
||||
NegotiateAPIVersion(ctx context.Context)
|
||||
NegotiateAPIVersionPing(types.Ping)
|
||||
DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error)
|
||||
HijackDialer
|
||||
Dialer() func(context.Context) (net.Conn, error)
|
||||
Close() error
|
||||
}
|
||||
|
||||
// HijackDialer defines methods for a hijack dialer.
|
||||
type HijackDialer interface {
|
||||
DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error)
|
||||
}
|
||||
|
||||
// ContainerAPIClient defines API client methods for the containers
|
||||
type ContainerAPIClient interface {
|
||||
ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error)
|
||||
|
||||
Reference in New Issue
Block a user