Documentation
¶
Index ¶
- type ConnectionConfig
- type ConnectionOption
- type DockerCLIConnectionConfig
- type DockerCLIConnectionOption
- type Doer
- type RequestOpt
- type Transport
- func DefaultTransport() (*Transport, error)
- func DefaultUnixTransport() (*Transport, error)
- func DefaultWindowsTransport() (*Transport, error)
- func FromConnectionString(s string, opts ...ConnectionOption) (*Transport, error)
- func FromConnectionURL(u *url.URL, opts ...ConnectionOption) (*Transport, error)
- func FromDockerCLI(opts ...DockerCLIConnectionOption) *Transport
- func NpipeTransport(path string, opts ...ConnectionOption) (*Transport, error)
- func TCPTransport(host string, opts ...ConnectionOption) (*Transport, error)
- func UnixSocketTransport(sock string, opts ...ConnectionOption) (*Transport, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionConfig ¶
ConnectionConfig holds the options available for configuring a new transport.
type ConnectionOption ¶
type ConnectionOption func(*ConnectionConfig) error
ConnectionOption is use as functional arguments for creating a Transport It configures a ConnectionConfig
type DockerCLIConnectionConfig ¶ added in v0.2.0
type DockerCLIConnectionConfig struct { // Env is the environment to use for the docker CLI // Useful for setting DOCKER_HOST or DOCKER_CONTEXT to specify the docker daemon that the docker cli should connect to // Defaults to os.Environ() Env []string // StderrPipe is the writer to use for the stderr of the docker CLI // This is the only means of getting error messages from the CLI. // // Deprecated: This is only here until validation is done on the cli connection. // Right now this is the only way to get failure details from the CLI. StderrPipe io.Writer }
DockerCLIConnectionConfig is the configuration for the DockerCLIConnectionOption
type DockerCLIConnectionOption ¶ added in v0.2.0
type DockerCLIConnectionOption func(*DockerCLIConnectionConfig) error
DockerCLIConnectionOption is an option for the FromDockerCLI function
type Doer ¶
type Doer interface { // Do typically performs a normal http request/response Do(ctx context.Context, method string, uri string, opts ...RequestOpt) (*http.Response, error) // DoRaw performs the request but passes along the response as a bi-directional stream DoRaw(ctx context.Context, method string, uri string, opts ...RequestOpt) (net.Conn, error) }
Doer performs an http request for Client It is the Doer's responsibility to deal with setting the host details on the request It is expected that one Doer connects to one Docker instance.
type RequestOpt ¶
RequestOpt is as functional arguments to configure an HTTP request for a Doer.
func WithAddHeaders ¶
func WithAddHeaders(headers map[string][]string) RequestOpt
WithAddHeaders is a RequestOpt that adds the specified headers to the request. If the header already exists, it will be appended to.
func WithUpgrade ¶
func WithUpgrade(proto string) RequestOpt
WithUpgrade is a RequestOpt that sets the request to upgrade to the specified protocol.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements the Doer interface for all the normal docker protocols). This would normally be things that would go over a net.Conn, such as unix or tcp sockets.
Create a transport from one of the available helper functions.
func DefaultTransport ¶
func DefaultUnixTransport ¶
func DefaultWindowsTransport ¶
func FromConnectionString ¶
func FromConnectionString(s string, opts ...ConnectionOption) (*Transport, error)
FromConnectionString creates a transport from the provided connection string This connection string is the one defined in the official docker client for DOCKER_HOST
func FromConnectionURL ¶
func FromConnectionURL(u *url.URL, opts ...ConnectionOption) (*Transport, error)
FromConnectionURL creates a Transport from a provided URL
The URL's scheme must specify the protocol ("unix", "tcp", etc.)
TODO: implement ssh schemes.
func FromDockerCLI ¶ added in v0.2.0
func FromDockerCLI(opts ...DockerCLIConnectionOption) *Transport
FromDockerCLI creates a Transport from the docker CLI In this case, the docker CLI acts as a proxy to the docker daemon. Any protocol your CLI supports, this transport will support.
func NpipeTransport ¶
func NpipeTransport(path string, opts ...ConnectionOption) (*Transport, error)
func TCPTransport ¶
func TCPTransport(host string, opts ...ConnectionOption) (*Transport, error)
func UnixSocketTransport ¶
func UnixSocketTransport(sock string, opts ...ConnectionOption) (*Transport, error)
UnixSocketTransport creates a Transport that works for unix sockets.
Note: This will attempt to use the TLSConfig if it is set on the connection options If you do not want to use TLS, do not set it on the connection options.