proxy-loadbalancer/src/config/validate.go

17 lines
280 B
Go

package config
import (
"errors"
"fmt"
"strings"
)
func ValidateProxies(proxies []string) error {
for _, proxy := range proxies {
if !strings.HasPrefix("http://", proxy) {
return errors.New(fmt.Sprintf(`proxy "%s" must start with http://`, proxy))
}
}
return nil
}