func GetProxyFromProxyGroup(id string) (*Proxy, error) {
	if !DoesProxyGroupExist(id) {
		return &Proxy{}, ProxyGroupDoesNotExistErr
	}
	proxyGroupMutex.Lock()
	defer proxyGroupMutex.Unlock()
	proxyGroup := proxyGroups[id]
	proxyIds := proxyGroup.Proxies.Keys()
	if len(proxyIds) == 0 {
		return &Proxy{}, ProxyGroupEmptyErr
	}
	firstProxyId := proxyIds[0]
	proxy, err := GetProxy(firstProxyId)
	if err != nil {
		return &Proxy{}, err
	}
	proxyGroup.Proxies.Delete(firstProxyId)
	proxyGroup.Proxies.Set(firstProxyId, true)
	return proxy, nil
}
GetProxyFromProxyGroup gets a proxy from a group
package proxy
import (
	"errors"
	"github.com/iancoleman/orderedmap"
	"github.com/lithammer/shortuuid"
	"sync"
)
var (
	proxyGroupMutex = sync.RWMutex{}
	ProxyGroupEmptyErr        = errors.New("proxy group does not contain any proxies")
	ProxyGroupDoesNotExistErr = errors.New("proxy group does not exist")
	proxyGroups               = make(map[string]*ProxyGroup)
)
func DoesProxyGroupExist(id string) bool {
	proxyGroupMutex.RLock()
	defer proxyGroupMutex.RUnlock()
	_, ok := proxyGroups[id]
	return ok
}
func CreateProxyGroup(name string) string {
	proxyGroupMutex.Lock()
	defer proxyGroupMutex.Unlock()
	id := shortuuid.New()
	proxyGroups[id] = &ProxyGroup{
		ID:      id,
		Name:    name,
		Proxies: orderedmap.New(),
	}
	return id
}
func RemoveProxyGroup(id string) error {
	if !DoesProxyGroupExist(id) {
		return ProxyGroupDoesNotExistErr
	}
	proxyGroupMutex.Lock()
	defer proxyGroupMutex.Unlock()
	delete(proxyGroups, id)
	return nil
}