rename ngin to rest

This commit is contained in:
kevin
2020-07-31 11:14:48 +08:00
parent e133ffd820
commit 0897f60c5d
78 changed files with 118 additions and 111 deletions

39
rest/config.go Normal file
View File

@@ -0,0 +1,39 @@
package rest
import (
"time"
"zero/core/service"
)
type (
PrivateKeyConf struct {
Fingerprint string
KeyFile string
}
SignatureConf struct {
Strict bool `json:",default=false"`
Expiry time.Duration `json:",default=1h"`
PrivateKeys []PrivateKeyConf
}
// why not name it as Conf, because we need to consider usage like:
// type Config struct {
// rpcx.RpcConf
// rest.RtConf
// }
// if with the name Conf, there will be two Conf inside Config.
RtConf struct {
service.ServiceConf
Host string `json:",default=0.0.0.0"`
Port int
Verbose bool `json:",optional"`
MaxConns int `json:",default=10000"`
MaxBytes int64 `json:",default=1048576,range=[0:8388608]"`
// milliseconds
Timeout int64 `json:",default=3000"`
CpuThreshold int64 `json:",default=900,range=[0:1000]"`
Signature SignatureConf `json:",optional"`
}
)