mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-01-17 08:01:23 +00:00
Generated largely from the specified config; small parts taken from `docker image inspect`, such as the command line. Renamed some of the yaml keys to match the OCI spec rather than Docker Compose as we decided they are more readable, no more underscores. Add some extra functionality - tmpfs specification - fully general mount specification - no new privileges can be specified now For nostalgic reasons, using engine-api to talk to the docker cli as we only need an old API version, and it is nice and easy to vendor... Signed-off-by: Justin Cormack <justin.cormack@docker.com>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package transport
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net/http"
|
|
)
|
|
|
|
// Sender is an interface that clients must implement
|
|
// to be able to send requests to a remote connection.
|
|
type Sender interface {
|
|
// Do sends request to a remote endpoint.
|
|
Do(*http.Request) (*http.Response, error)
|
|
}
|
|
|
|
// Client is an interface that abstracts all remote connections.
|
|
type Client interface {
|
|
Sender
|
|
// Secure tells whether the connection is secure or not.
|
|
Secure() bool
|
|
// Scheme returns the connection protocol the client uses.
|
|
Scheme() string
|
|
// TLSConfig returns any TLS configuration the client uses.
|
|
TLSConfig() *tls.Config
|
|
}
|
|
|
|
// tlsInfo returns information about the TLS configuration.
|
|
type tlsInfo struct {
|
|
tlsConfig *tls.Config
|
|
}
|
|
|
|
// TLSConfig returns the TLS configuration.
|
|
func (t *tlsInfo) TLSConfig() *tls.Config {
|
|
return t.tlsConfig
|
|
}
|
|
|
|
// Scheme returns protocol scheme to use.
|
|
func (t *tlsInfo) Scheme() string {
|
|
if t.tlsConfig != nil {
|
|
return "https"
|
|
}
|
|
return "http"
|
|
}
|
|
|
|
// Secure returns true if there is a TLS configuration.
|
|
func (t *tlsInfo) Secure() bool {
|
|
return t.tlsConfig != nil
|
|
}
|