func (p *Proxy) validateConfig() error {
	if p.started {
		return errors.New("server has been already started")
	}

	if p.UDPListenAddr == nil && p.TCPListenAddr == nil && p.TLSListenAddr == nil && p.HTTPSListenAddr == nil {
		return errors.New("no listen address specified")
	}

	if p.TLSListenAddr != nil && p.TLSConfig == nil {
		return errors.New("cannot create a TLS listener without TLS config")
	}

	if p.HTTPSListenAddr != nil && p.TLSConfig == nil {
		return errors.New("cannot create an HTTPS listener without TLS config")
	}

	if len(p.Upstreams) == 0 {
		return errors.New("no upstreams specified")
	}

	if p.Ratelimit > 0 {
		log.Printf("Ratelimit is enabled and set to %d rps", p.Ratelimit)
	}

	if p.RefuseAny {
		log.Print("The server is configured to refuse ANY requests")
	}

	return nil
}
// validateConfig verifies that the supplied configuration is valid and returns an error if it's not
validateConfig verifies that the supplied configuration is valid and returns an error if it's not
// validateConfig verifies that the supplied configuration is valid and returns an error if it ' s not
func (p *Proxy) validateConfig() error {
	if p.started {
		return errors.New("server has been already started")
	}
	if p.UDPListenAddr == nil && p.TCPListenAddr == nil && p.TLSListenAddr == nil && p.HTTPSListenAddr == nil {
		return errors.New("no listen address specified")
	}
	if p.TLSListenAddr != nil && p.TLSConfig == nil {
		return errors.New("cannot create a TLS listener without TLS config")
	}
	if p.HTTPSListenAddr != nil && p.TLSConfig == nil {
		return errors.New("cannot create an HTTPS listener without TLS config")
	}
	if len(p.Upstreams) == 0 {
		return errors.New("no upstreams specified")
	}
	if p.Ratelimit > 0 {
		log.Printf("Ratelimit is enabled and set to %d rps", p.Ratelimit)
	}
	if p.RefuseAny {
		log.Print("The server is configured to refuse ANY requests")
	}
	return nil
}
func ( p * Proxy ) validateConfig ( ) error { if p . started { return errors . New ( " " ) } if p . UDPListenAddr == nil && p . TCPListenAddr == nil && p . TLSListenAddr == nil && p . HTTPSListenAddr == nil { return errors . New ( " " ) } if p . TLSListenAddr != nil && p . TLSConfig == nil { return errors . New ( " " ) } if p . HTTPSListenAddr != nil && p . TLSConfig == nil { return errors . New ( " " ) } if len ( p . Upstreams ) == 0 { return errors . New ( " " ) } if p . Ratelimit > 0 { log . Printf ( " " , p . Ratelimit ) } if p . RefuseAny { log . Print ( " " ) } return nil }
validateConfig verifies that the supplied configuration is valid and returns an error if it's not
validateConfig verifies that the supplied configuration is valid and returns an error if it ' s not