github.com/hms58/moby@v1.13.1/pkg/listeners/listeners_solaris.go (about)

     1  package listeners
     2  
     3  import (
     4  	"crypto/tls"
     5  	"fmt"
     6  	"net"
     7  
     8  	"github.com/docker/go-connections/sockets"
     9  )
    10  
    11  // Init creates new listeners for the server.
    12  func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) (ls []net.Listener, err error) {
    13  	switch proto {
    14  	case "tcp":
    15  		l, err := sockets.NewTCPSocket(addr, tlsConfig)
    16  		if err != nil {
    17  			return nil, err
    18  		}
    19  		ls = append(ls, l)
    20  	case "unix":
    21  		l, err := sockets.NewUnixSocket(addr, socketGroup)
    22  		if err != nil {
    23  			return nil, fmt.Errorf("can't create unix socket %s: %v", addr, err)
    24  		}
    25  		ls = append(ls, l)
    26  	default:
    27  		return nil, fmt.Errorf("Invalid protocol format: %q", proto)
    28  	}
    29  
    30  	return
    31  }