code: func newTransport(conf *memberlist.Config) (*memberlist.NetTransport, error) {
  	nc := &memberlist.NetTransportConfig{
  		BindAddrs: []string{conf.BindAddr},
  		BindPort:  conf.BindPort,
  		Logger:    conf.Logger,
  	}
  
  	// See comment below for details about the retry in here.
  	makeNetRetry := func(limit int) (*memberlist.NetTransport, error) {
  		var err error
  		for try := 0; try < limit; try++ {
  			var nt *memberlist.NetTransport
  			if nt, err = memberlist.NewNetTransport(nc); err == nil {
  				return nt, nil
  			}
  			if strings.Contains(err.Error(), "address already in use") {
  				conf.Logger.Printf("[DEBUG] Got bind error: %v", err)
  				continue
  			}
  		}
  
  		return nil, fmt.Errorf("failed to obtain an address: %v", err)
  	}
  
  	// The dynamic bind port operation is inherently racy because
  	// even though we are using the kernel to find a port for us, we
  	// are attempting to bind multiple protocols (and potentially
  	// multiple addresses) with the same port number. We build in a
  	// few retries here since this often gets transient errors in
  	// busy unit tests.
  	limit := 1
  	if conf.BindPort == 0 {
  		limit = 10
  	}
  
  	nt, err := makeNetRetry(limit)
  	if err != nil {
  		return nil, errors.Wrap(err, "could not set up network transport")
  	}
  
  	return nt, nil
  }
docs: // newTransport returns a NetTransport based on the memberlist configuration.
  // It will dynamically bind to a port if conf.BindPort is 0.