Lint on pkg/* packages
- pkg/useragent - pkg/units - pkg/ulimit - pkg/truncindex - pkg/timeoutconn - pkg/term - pkg/tarsum - pkg/tailfile - pkg/systemd - pkg/stringutils - pkg/stringid - pkg/streamformatter - pkg/sockets - pkg/signal - pkg/proxy - pkg/progressreader - pkg/pools - pkg/plugins - pkg/pidfile - pkg/parsers - pkg/parsers/filters - pkg/parsers/kernel - pkg/parsers/operatingsystem Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
a922d62168
commit
9bcb3cba83
56 changed files with 455 additions and 195 deletions
|
@ -1,3 +1,5 @@
|
|||
// Package sockets provides helper functions to create and configure Unix or TCP
|
||||
// sockets.
|
||||
package sockets
|
||||
|
||||
import (
|
||||
|
@ -9,7 +11,12 @@ import (
|
|||
"github.com/docker/docker/pkg/listenbuffer"
|
||||
)
|
||||
|
||||
func NewTcpSocket(addr string, tlsConfig *tls.Config, activate <-chan struct{}) (net.Listener, error) {
|
||||
// NewTCPSocket creates a TCP socket listener with the specified address and
|
||||
// and the specified tls configuration. If TLSConfig is set, will encapsulate the
|
||||
// TCP listener inside a TLS one.
|
||||
// The channel passed is used to activate the listenbuffer when the caller is ready
|
||||
// to accept connections.
|
||||
func NewTCPSocket(addr string, tlsConfig *tls.Config, activate <-chan struct{}) (net.Listener, error) {
|
||||
l, err := listenbuffer.NewListenBuffer("tcp", addr, activate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -21,6 +28,10 @@ func NewTcpSocket(addr string, tlsConfig *tls.Config, activate <-chan struct{})
|
|||
return l, nil
|
||||
}
|
||||
|
||||
// ConfigureTCPTransport configures the specified Transport according to the
|
||||
// specified proto and addr.
|
||||
// If the proto is unix (using a unix socket to communicate) the compression
|
||||
// is disabled.
|
||||
func ConfigureTCPTransport(tr *http.Transport, proto, addr string) {
|
||||
// Why 32? See https://github.com/docker/docker/pull/8035.
|
||||
timeout := 32 * time.Second
|
||||
|
|
|
@ -14,6 +14,9 @@ import (
|
|||
"github.com/opencontainers/runc/libcontainer/user"
|
||||
)
|
||||
|
||||
// NewUnixSocket creates a unix socket with the specified path and group.
|
||||
// The channel passed is used to activate the listenbuffer when the caller is ready
|
||||
// to accept connections.
|
||||
func NewUnixSocket(path, group string, activate <-chan struct{}) (net.Listener, error) {
|
||||
if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue