|
@@ -1,6 +1,8 @@
|
|
package zrpc
|
|
package zrpc
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "time"
|
|
|
|
+
|
|
"github.com/zeromicro/go-zero/core/discov"
|
|
"github.com/zeromicro/go-zero/core/discov"
|
|
"github.com/zeromicro/go-zero/core/service"
|
|
"github.com/zeromicro/go-zero/core/service"
|
|
"github.com/zeromicro/go-zero/core/stores/redis"
|
|
"github.com/zeromicro/go-zero/core/stores/redis"
|
|
@@ -14,6 +16,19 @@ type (
|
|
// ServerMiddlewaresConf defines whether to use server middlewares.
|
|
// ServerMiddlewaresConf defines whether to use server middlewares.
|
|
ServerMiddlewaresConf = internal.ServerMiddlewaresConf
|
|
ServerMiddlewaresConf = internal.ServerMiddlewaresConf
|
|
|
|
|
|
|
|
+ // A RpcClientConf is a rpc client config.
|
|
|
|
+ RpcClientConf struct {
|
|
|
|
+ Etcd discov.EtcdConf `json:",optional,inherit"`
|
|
|
|
+ Endpoints []string `json:",optional"`
|
|
|
|
+ Target string `json:",optional"`
|
|
|
|
+ App string `json:",optional"`
|
|
|
|
+ Token string `json:",optional"`
|
|
|
|
+ NonBlock bool `json:",optional"`
|
|
|
|
+ Timeout int64 `json:",default=2000"`
|
|
|
|
+ KeepaliveTime time.Duration `json:",default=20s"`
|
|
|
|
+ Middlewares ClientMiddlewaresConf
|
|
|
|
+ }
|
|
|
|
+
|
|
// A RpcServerConf is a rpc server config.
|
|
// A RpcServerConf is a rpc server config.
|
|
RpcServerConf struct {
|
|
RpcServerConf struct {
|
|
service.ServiceConf
|
|
service.ServiceConf
|
|
@@ -29,18 +44,6 @@ type (
|
|
Health bool `json:",default=true"`
|
|
Health bool `json:",default=true"`
|
|
Middlewares ServerMiddlewaresConf
|
|
Middlewares ServerMiddlewaresConf
|
|
}
|
|
}
|
|
-
|
|
|
|
- // A RpcClientConf is a rpc client config.
|
|
|
|
- RpcClientConf struct {
|
|
|
|
- Etcd discov.EtcdConf `json:",optional,inherit"`
|
|
|
|
- Endpoints []string `json:",optional"`
|
|
|
|
- Target string `json:",optional"`
|
|
|
|
- App string `json:",optional"`
|
|
|
|
- Token string `json:",optional"`
|
|
|
|
- NonBlock bool `json:",optional"`
|
|
|
|
- Timeout int64 `json:",default=2000"`
|
|
|
|
- Middlewares ClientMiddlewaresConf
|
|
|
|
- }
|
|
|
|
)
|
|
)
|
|
|
|
|
|
// NewDirectClientConf returns a RpcClientConf.
|
|
// NewDirectClientConf returns a RpcClientConf.
|