当前位置: 首页>>代码示例>>Golang>>正文


Golang Context.Int方法代码示例

本文整理汇总了Golang中github.com/mailgun/vulcand/Godeps/_workspace/src/github.com/codegangsta/cli.Context.Int方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Int方法的具体用法?Golang Context.Int怎么用?Golang Context.Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/mailgun/vulcand/Godeps/_workspace/src/github.com/codegangsta/cli.Context的用法示例。


在下文中一共展示了Context.Int方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: getFrontendSettings

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")

	return s, nil
}
开发者ID:davemkirk,项目名称:vulcand,代码行数:12,代码来源:frontend.go

示例2: FromCli

// FromCli constructs the middleware from the command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	opts := secure.Options{
		SSLRedirect:           true,
		SSLProxyHeaders:       map[string]string{"X-Forwarded-Proto": "https"},
		STSSeconds:            int64(c.Int("sts-seconds")),
		STSPreload:            c.Bool("sts-preload"),
		FrameDeny:             c.Bool("frame-deny"),
		ContentTypeNosniff:    c.Bool("no-sniff"),
		BrowserXssFilter:      c.Bool("xss-filter"),
		ContentSecurityPolicy: c.String("content-security-policy"),
	}
	return New(opts)
}
开发者ID:philk,项目名称:vulcand-secure,代码行数:14,代码来源:secure.go

示例3: getBackendSettings

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
}
开发者ID:davemkirk,项目名称:vulcand,代码行数:17,代码来源:backend.go

示例4: getTLSSettings

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
}
开发者ID:davemkirk,项目名称:vulcand,代码行数:20,代码来源:tls.go

示例5: getOptions

func getOptions(c *cli.Context) (backend.LocationOptions, error) {
	o := backend.LocationOptions{}

	o.Timeouts.Read = c.Duration("readTimeout").String()
	o.Timeouts.Dial = c.Duration("dialTimeout").String()
	o.Timeouts.TlsHandshake = c.Duration("handshakeTimeout").String()

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

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

	o.FailoverPredicate = c.String("failoverPredicate")
	o.Hostname = c.String("forwardHost")
	o.TrustForwardHeader = c.Bool("trustForwardHeader")

	return o, nil
}
开发者ID:jeremyschlatter,项目名称:vulcand,代码行数:19,代码来源:location.go

示例6: FromCli

// Constructs the middleware from the command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return NewRateLimit(c.Int("requests"), c.String("var"), int64(c.Int("burst")), c.Int("period"))
}
开发者ID:jeremyschlatter,项目名称:vulcand,代码行数:4,代码来源:ratelimit.go

示例7: topAction

func (cmd *Command) topAction(c *cli.Context) {
	cmd.overviewAction(c.String("backend"), c.Int("refresh"), c.Int("limit"))
}
开发者ID:davemkirk,项目名称:vulcand,代码行数:3,代码来源:status.go

示例8: FromCli

// Constructs the middleware from the command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return NewConnLimit(int64(c.Int("connections")), c.String("var"))
}
开发者ID:jeremyschlatter,项目名称:vulcand,代码行数:4,代码来源:connlimit.go


注:本文中的github.com/mailgun/vulcand/Godeps/_workspace/src/github.com/codegangsta/cli.Context.Int方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。