package internal import "sync" type Account struct { User string Pass string } var ( accounts = make(map[string]Account) lock sync.RWMutex ) func AddAccount(endpoints []string, user, pass string) { lock.Lock() defer lock.Unlock() accounts[getClusterKey(endpoints)] = Account{ User: user, Pass: pass, } } func GetAccount(endpoints []string) (Account, bool) { lock.RLock() defer lock.RUnlock() account, ok := accounts[getClusterKey(endpoints)] return account, ok }