feat:完善项目

This commit is contained in:
henry
2021-09-28 11:47:19 +08:00
commit da7b3130fe
167 changed files with 456676 additions and 0 deletions

24
rpc/client/auth.go Normal file
View File

@ -0,0 +1,24 @@
package client
import "context"
type Auth struct {
isTLS bool
Value string
}
const headerAuthorize string = "authorization"
func (a *Auth) SetIsTLS(status bool) {
a.isTLS = status
}
// GetRequestMetadata 获取当前请求认证所需的元数据
func (a *Auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
return map[string]string{headerAuthorize: a.Value}, nil
}
// RequireTransportSecurity 是否需要基于 TLS 认证进行安全传输
func (a *Auth) RequireTransportSecurity() bool {
return a.isTLS
}