func (c *ProxyConfig) CheckAndSetDefaults() error {
	if c.WebTLSConfig == nil {
		return trace.BadParameter("tls config missing")
	}
	if c.Listener == nil {
		return trace.BadParameter("listener missing")
	}
	if c.Log == nil {
		c.Log = logrus.WithField(trace.Component, "alpn:proxy")
	}
	if c.Clock == nil {
		c.Clock = clockwork.NewRealClock()
	}
	if c.ReadDeadline == 0 {
		c.ReadDeadline = defaults.HandshakeReadDeadline
	}
	if c.Router == nil {
		return trace.BadParameter("missing parameter router")
	}
	if err := c.Router.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	if c.AccessPoint == nil {
		return trace.BadParameter("missing access point")
	}
	if c.ClusterName == "" {
		return trace.BadParameter("missing cluster name")
	}

	if c.IdentityTLSConfig == nil {
		return trace.BadParameter("missing identity tls config")
	}
	c.IdentityTLSConfig = c.IdentityTLSConfig.Clone()
	c.IdentityTLSConfig.ClientAuth = tls.RequireAndVerifyClientCert
	fn := auth.WithClusterCAs(c.IdentityTLSConfig, c.AccessPoint, c.ClusterName, c.Log)
	c.IdentityTLSConfig.GetConfigForClient = fn

	return nil
}
// CheckAndSetDefaults checks and sets default values of ProxyConfig
CheckAndSetDefaults checks and sets default values of ProxyConfig
// CheckAndSetDefaults checks and sets default values of ProxyConfig
func (c *ProxyConfig) CheckAndSetDefaults() error {
	if c.WebTLSConfig == nil {
		return trace.BadParameter("tls config missing")
	}
	if c.Listener == nil {
		return trace.BadParameter("listener missing")
	}
	if c.Log == nil {
		c.Log = logrus.WithField(trace.Component, "alpn:proxy")
	}
	if c.Clock == nil {
		c.Clock = clockwork.NewRealClock()
	}
	if c.ReadDeadline == 0 {
		c.ReadDeadline = defaults.HandshakeReadDeadline
	}
	if c.Router == nil {
		return trace.BadParameter("missing parameter router")
	}
	if err := c.Router.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	if c.AccessPoint == nil {
		return trace.BadParameter("missing access point")
	}
	if c.ClusterName == "" {
		return trace.BadParameter("missing cluster name")
	}
	if c.IdentityTLSConfig == nil {
		return trace.BadParameter("missing identity tls config")
	}
	c.IdentityTLSConfig = c.IdentityTLSConfig.Clone()
	c.IdentityTLSConfig.ClientAuth = tls.RequireAndVerifyClientCert
	fn := auth.WithClusterCAs(c.IdentityTLSConfig, c.AccessPoint, c.ClusterName, c.Log)
	c.IdentityTLSConfig.GetConfigForClient = fn
	return nil
}
func ( c * ProxyConfig ) CheckAndSetDefaults ( ) error { if c . WebTLSConfig == nil { return trace . BadParameter ( " " ) } if c . Listener == nil { return trace . BadParameter ( " " ) } if c . Log == nil { c . Log = logrus . WithField ( trace . Component , " " ) } if c . Clock == nil { c . Clock = clockwork . NewRealClock ( ) } if c . ReadDeadline == 0 { c . ReadDeadline = defaults . HandshakeReadDeadline } if c . Router == nil { return trace . BadParameter ( " " ) } if err := c . Router . CheckAndSetDefaults ( ) ; err != nil { return trace . Wrap ( err ) } if c . AccessPoint == nil { return trace . BadParameter ( " " ) } if c . ClusterName == " " { return trace . BadParameter ( " " ) } if c . IdentityTLSConfig == nil { return trace . BadParameter ( " " ) } c . IdentityTLSConfig = c . IdentityTLSConfig . Clone ( ) c . IdentityTLSConfig . ClientAuth = tls . RequireAndVerifyClientCert fn := auth . WithClusterCAs ( c . IdentityTLSConfig , c . AccessPoint , c . ClusterName , c . Log ) c . IdentityTLSConfig . GetConfigForClient = fn return nil }
CheckAndSetDefaults checks and sets default values of ProxyConfig
CheckAndSetDefaults checks and sets default values of ProxyConfig