code: func (a *Agent) setupKeyrings(config *consul.Config) error {
  	// First set up the LAN and WAN keyrings.
  	if err := a.setupBaseKeyrings(config); err != nil {
  		return err
  	}
  
  	// If there's no LAN keyring then there's nothing else to set up for
  	// any segments.
  	lanKeyring := config.SerfLANConfig.MemberlistConfig.Keyring
  	if lanKeyring == nil {
  		return nil
  	}
  
  	// Copy the initial state of the LAN keyring into each segment config.
  	// Segments don't have their own keyring file, they rely on the LAN
  	// holding the state so things can't get out of sync.
  	k, pk := lanKeyring.GetKeys(), lanKeyring.GetPrimaryKey()
  	for _, segment := range config.Segments {
  		keyring, err := memberlist.NewKeyring(k, pk)
  		if err != nil {
  			return err
  		}
  		segment.SerfConfig.MemberlistConfig.Keyring = keyring
  	}
  	return nil
  }
docs: // setupKeyrings is used to initialize and load keyrings during agent startup.