예제 #1
0
파일: server.go 프로젝트: tomasen/restful
func (s *Server) initTCPSocket(addr string) (l net.Listener, err error) {
	if s.cfg.TLSConfig == nil || s.cfg.TLSConfig.ClientAuth != tls.RequireAndVerifyClientCert {
		logrus.Warn("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
	}
	if l, err = sockets.NewTCPSocket(addr, s.cfg.TLSConfig, s.start); err != nil {
		return nil, err
	}
	return
}
예제 #2
0
func newTCPListener(
	volumeDriverName string,
	address string,
	start <-chan struct{},
) (net.Listener, string, error) {
	listener, err := sockets.NewTCPSocket(address, nil, start)
	if err != nil {
		return nil, "", err
	}
	spec, err := writeSpec(volumeDriverName, listener.Addr().String())
	if err != nil {
		return nil, "", err
	}
	return listener, spec, nil
}