package loadmodule

import (
	"net/url"
)

type ProxyLoadType int

const (
	RandomProxyModule     ProxyLoadType = iota //随机
	RoundRobinProxyModule                      //轮询
	HashProxyModule                            //哈希
)

type ProxyLoadModule interface {
	Get(string) (*url.URL, error) //获取节点
	Add(string) error             //添加节点
	Del(string) error             //动态添加
}

// LoadProxyLoadFactory 节点负载模式
func LoadProxyLoadFactory(value int) ProxyLoadModule {
	switch ProxyLoadType(value) {
	case RandomProxyModule: //随机
		return &RandomProxy{}
	case RoundRobinProxyModule: //轮询
		return &RoundRobinProxy{}
	case HashProxyModule: //哈希
		return &HashProxy{}
	default:
		return &RandomProxy{}
	}
}
