code: func (m *Main) openStore() error {
  	// If the advertised address is not in the peer list then we should proxy.
  
  	// Resolve advertised address.
  	addr, err := net.ResolveTCPAddr("tcp", m.advertiseAddr)
  	if err != nil {
  		return err
  	}
  
  	// Listen via mux
  	storeLn := m.mux.Listen([]byte{server.StoreHdr})
  
  	// Initialize store.
  	s := server.NewStore(m.dataDir)
  	s.Listener = storeLn
  	s.Advertise = addr
  
  	// Allow single node if there's no peers set.
  	s.EnableSingleNode = len(m.peers) <= 1
  
  	// Open store.
  	if err := s.Open(); err != nil {
  		return err
  	}
  	m.store = s
  
  	// If peers then set peer set.
  	if len(m.peers) > 0 {
  		if err := s.SetPeers(m.peers); err != nil {
  			return fmt.Errorf("set peers: %s", err)
  		}
  	}
  
  	return nil
  }
docs: // openStore initializes and opens the store.