1.认证配置选项(来自官方文档)
RpcServerConf struct {
service.ServiceConf // 服务配置,详情见api配置说明,这里不赘述
ListenOn string // rpc监听地址和端口,如:127.0.0.1:8888
Etcd discov.EtcdConf `json:",optional"` // etcd相关配置
Auth bool `json:",optional"` // 是否开启Auth,如果是则Redis为必填
Redis redis.RedisKeyConf `json:",optional"` // Auth验证
StrictControl bool `json:",optional"` // 是否Strict模式,如果是则遇到错误是Auth失败,否则可以认为成功
// pending forever is not allowed
// never set it to 0, if zero, the underlying will set to 2s automatically
Timeout int64 `json:",default=2000"` // 超时控制,单位:毫秒
CpuThreshold int64 `json:",default=900,range=[0:1000]"` cpu降载阈值,默认900,可允许设置范围0到1000
}
2.认证初始化代码注解