Esempio n. 1
0
func getFrontendSettings(c *cli.Context) (engine.HTTPFrontendSettings, error) {
	s := engine.HTTPFrontendSettings{}

	s.Limits.MaxMemBodyBytes = int64(c.Int("maxMemBodyKB") * 1024)
	s.Limits.MaxBodyBytes = int64(c.Int("maxBodyKB") * 1024)

	s.FailoverPredicate = c.String("failoverPredicate")
	s.Hostname = c.String("forwardHost")
	s.TrustForwardHeader = c.Bool("trustForwardHeader")
	s.PassHostHeader = c.Bool("passHostHeader")

	return s, nil
}
Esempio n. 2
0
func getBackendSettings(c *cli.Context) (engine.HTTPBackendSettings, error) {
	s := engine.HTTPBackendSettings{}

	s.Timeouts.Read = c.Duration("readTimeout").String()
	s.Timeouts.Dial = c.Duration("dialTimeout").String()
	s.Timeouts.TLSHandshake = c.Duration("handshakeTimeout").String()

	s.KeepAlive.Period = c.Duration("keepAlivePeriod").String()
	s.KeepAlive.MaxIdleConnsPerHost = c.Int("maxIdleConns")

	tlsSettings, err := getTLSSettings(c)
	if err != nil {
		return s, err
	}
	s.TLS = tlsSettings
	return s, nil
}
Esempio n. 3
0
File: tls.go Progetto: huhoo/vulcand
func getTLSSettings(c *cli.Context) (*engine.TLSSettings, error) {
	s := &engine.TLSSettings{
		InsecureSkipVerify:       c.Bool("tlsSkipVerify"),
		PreferServerCipherSuites: c.Bool("tlsPreferServerCS"),
		SessionTicketsDisabled:   c.Bool("tlsSessionTicketsOff"),
		MinVersion:               c.String("tlsMinV"),
		MaxVersion:               c.String("tlsMaxV"),
		CipherSuites:             c.StringSlice("tlsCS"),
	}
	s.SessionCache.Type = c.String("tlsSessionCache")
	if s.SessionCache.Type == engine.LRUCacheType {
		s.SessionCache.Settings = &engine.LRUSessionCacheSettings{
			Capacity: c.Int("tlsSessionCacheCapacity"),
		}
	}
	if _, err := engine.NewTLSConfig(s); err != nil {
		return nil, err
	}
	return s, nil
}
Esempio n. 4
0
// FromCli constructs a middleware instance from the command line parameters.
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return FromOther(
		RateLimit{
			PeriodSeconds: int64(c.Int("period")),
			Requests:      int64(c.Int("requests")),
			Burst:         int64(c.Int("burst")),
			Variable:      c.String("var"),
			RateVar:       c.String("rateVar")})
}
Esempio n. 5
0
// Constructs the middleware from the command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return NewConnLimit(int64(c.Int("connections")), c.String("var"))
}
Esempio n. 6
0
func (cmd *Command) topAction(c *cli.Context) {
	cmd.overviewAction(c.String("backend"), c.Int("refresh"), c.Int("limit"))
}