Пример #1
0
// LoadSite implements caddytls.Storage.LoadSite in memory.
func (s *InMemoryStorage) LoadSite(domain string) (*caddytls.SiteData, error) {
	siteData, ok := s.Sites[domain]
	if !ok {
		return nil, caddytls.ErrNotExist(errors.New("not found"))
	}
	return siteData, nil
}
Пример #2
0
// DeleteSite implements caddytls.Storage.DeleteSite in memory.
func (s *InMemoryStorage) DeleteSite(domain string) error {
	if _, ok := s.Sites[domain]; !ok {
		return caddytls.ErrNotExist(errors.New("not found"))
	}
	delete(s.Sites, domain)
	return nil
}
Пример #3
0
// LoadUser implements caddytls.Storage.LoadUser in memory.
func (s *InMemoryStorage) LoadUser(email string) (*caddytls.UserData, error) {
	userData, ok := s.Users[email]
	if !ok {
		return nil, caddytls.ErrNotExist(errors.New("not found"))
	}
	return userData, nil
}