commandconn

package
v20.10.16+incompatible Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package commandconn provides a net.Conn implementation that can be used for proxying (or emulating) stream via a custom command.

For example, to provide an http.Client that can connect to a Docker daemon running in a Docker container ("DIND"):

httpClient := &http.Client{
	Transport: &http.Transport{
		DialContext: func(ctx context.Context, _network, _addr string) (net.Conn, error) {
			return commandconn.New(ctx, "docker", "exec", "-it", containerID, "docker", "system", "dial-stdio")
		},
	},
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, cmd string, args ...string) (net.Conn, error)

New returns net.Conn

Types

This section is empty.

Jump to

Keyboard shortcuts

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