pkg

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InternalCallTokenHeader todo
	InternalCallTokenHeader = "internal-call-token"
	// ClientIDHeader tood
	ClientIDHeader = "client-id"
	// ClientSecretHeader todo
	ClientSecretHeader = "client-secret"
	// OauthTokenHeader todo
	OauthTokenHeader = "x-oauth-token"
	// RealIPHeader todo
	RealIPHeader = "x-real-ip"
	// UserAgentHeader todo
	UserAgentHeader = "user-agent"
)
View Source
const (
	// ResponseCodeHeader todo
	ResponseCodeHeader = "x-rpc-code"
	// ResponseReasonHeader todo
	ResponseReasonHeader = "x-rpc-reason"
	// ResponseDescHeader todo
	ResponseDescHeader = "x-rpc-desc"
	// ResponseMetaHeader todo
	ResponseMetaHeader = "x-rpc-meta"
	// ResponseDataHeader todo
	ResponseDataHeader = "x-rpc-data"
)

Variables

View Source
var (
	// Domain 服务
	Domain domain.DomainServiceServer
	// User 用户服务
	User user.UserServiceServer
	// ApplicationUser 应用
	ApplicationUser application.UserServiceServer
	// ApplicationAdmin 应用
	ApplicationAdmin application.AdminServiceServer
	// Token 令牌服务
	Token token.TokenServiceServer
	// Micro todo
	Micro micro.MicroServiceServer
	// Role 角色服务
	Role role.RoleServiceServer
	// Endpoint 端点服务
	Endpoint endpoint.EndpointServiceServer
	// Policy 厕所里
	Policy policy.PolicyServiceServer
	// Department 部分服务
	Department department.DepartmentServiceServer
	// Namespace todo
	Namespace namespace.NamespaceServiceServer
	// Permission 权限服务
	Permission permission.PermissionServiceServer
	// Counter 自增ID服务
	Counter counter.Service
	// LDAP ldap服务
	LDAP provider.LDAP
	// GEOIP geoip服务
	GEOIP geoip.Service
	// IP2Region ip位置查询
	IP2Region ip2region.Service
	// Storage 对象存储服务
	Storage storage.Service
	// SessionAdmin 审计服务
	SessionAdmin session.AdminServiceServer
	// SessionUser todo
	SessionUser session.UserServiceServer
	// System 系统服务
	System system.Service
	// VerifyCode 校验码服务
	VerifyCode verifycode.VerifyCodeServiceServer
)

Functions

func AuthUnaryServerInterceptor added in v0.2.0

func AuthUnaryServerInterceptor() grpc.UnaryServerInterceptor

AuthUnaryServerInterceptor returns a new unary server interceptor for auth.

func GetGrpcPathEntry added in v0.2.0

func GetGrpcPathEntry(path string) *http.Entry

GetGrpcPathEntry todo

func GetTokenFromGrpcInCtx added in v0.2.0

func GetTokenFromGrpcInCtx(ctx context.Context) (*token.Token, error)

GetTokenFromGrpcInCtx todo

func HTTPEntry added in v0.2.0

func HTTPEntry() *http.EntrySet

HTTPEntry todo

func InitService

func InitService() error

InitService 初始化所有服务

func InitV1GRPCAPI added in v0.2.0

func InitV1GRPCAPI(server *grpc.Server)

InitV1GRPCAPI 初始化API服务

func InitV1HTTPAPI

func InitV1HTTPAPI(pathPrefix string, root router.Router) error

InitV1HTTPAPI 初始化API服务

func LoadedHTTP added in v0.2.0

func LoadedHTTP() []string

LoadedHTTP 查询加载成功的HTTP API

func LoadedService

func LoadedService() []string

LoadedService 查询加载成功的服务

func NewExceptionFromTrailer added in v0.2.0

func NewExceptionFromTrailer(md metadata.MD, err error) exception.APIException

NewExceptionFromTrailer todo

func RegistryHTTPV1

func RegistryHTTPV1(name string, api HTTPAPI)

RegistryHTTPV1 注册HTTP服务

func RegistryService

func RegistryService(name string, svr Service)

RegistryService 服务实例注册

Types

type GrpcInCtx added in v0.2.0

type GrpcInCtx struct {
	// contains filtered or unexported fields
}

GrpcInCtx todo

func GetGrpcInCtx added in v0.2.0

func GetGrpcInCtx(ctx context.Context) (*GrpcInCtx, error)

GetGrpcInCtx todo

func NewGrpcInCtx added in v0.2.0

func NewGrpcInCtx() *GrpcInCtx

NewGrpcInCtx todo

func NewInternalMockGrpcCtx added in v0.2.0

func NewInternalMockGrpcCtx(account string) *GrpcInCtx

NewInternalMockGrpcCtx todo

func (*GrpcInCtx) ClearInternl added in v0.2.0

func (c *GrpcInCtx) ClearInternl() *GrpcInCtx

ClearInternl todo

func (*GrpcInCtx) Context added in v0.2.0

func (c *GrpcInCtx) Context() context.Context

Context todo

func (*GrpcInCtx) GetAccessToKen added in v0.2.0

func (c *GrpcInCtx) GetAccessToKen() string

GetAccessToKen todo

func (*GrpcInCtx) GetClientID added in v0.2.0

func (c *GrpcInCtx) GetClientID() string

GetClientID todo

func (*GrpcInCtx) GetClientSecret added in v0.2.0

func (c *GrpcInCtx) GetClientSecret() string

GetClientSecret todo

func (*GrpcInCtx) GetToken added in v0.2.0

func (c *GrpcInCtx) GetToken() (*token.Token, error)

GetToken todo

func (*GrpcInCtx) InternalCallToken added in v0.2.0

func (c *GrpcInCtx) InternalCallToken() *token.Token

InternalCallToken 是不是内部调用

func (*GrpcInCtx) IsInternalCall added in v0.2.0

func (c *GrpcInCtx) IsInternalCall() bool

IsInternalCall todo

func (GrpcInCtx) SetAccessToken added in v0.2.0

func (c GrpcInCtx) SetAccessToken(ak string)

SetAccessToken todo

func (*GrpcInCtx) SetClientCredentials added in v0.2.0

func (c *GrpcInCtx) SetClientCredentials(clientID, clientSecret string)

SetClientCredentials todo

func (*GrpcInCtx) SetIsInternalCall added in v0.2.0

func (c *GrpcInCtx) SetIsInternalCall(account, domain string)

SetIsInternalCall 内部调用不需要认证, 直接传给server端的接口

type GrpcOutCtx added in v0.2.0

type GrpcOutCtx struct {
	// contains filtered or unexported fields
}

GrpcOutCtx todo

func NewGrpcOutCtx added in v0.2.0

func NewGrpcOutCtx() *GrpcOutCtx

NewGrpcOutCtx todo

func NewGrpcOutCtxFromHTTPRequest added in v0.2.0

func NewGrpcOutCtxFromHTTPRequest(r *http.Request) (*GrpcOutCtx, error)

NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token

func (*GrpcOutCtx) Context added in v0.2.0

func (c *GrpcOutCtx) Context() context.Context

Context todo

func (*GrpcOutCtx) GetToken added in v0.2.0

func (c *GrpcOutCtx) GetToken() (*token.Token, error)

GetToken todo

func (GrpcOutCtx) SetAccessToken added in v0.2.0

func (c GrpcOutCtx) SetAccessToken(ak string)

SetAccessToken todo

func (*GrpcOutCtx) SetRemoteIP added in v0.2.0

func (c *GrpcOutCtx) SetRemoteIP(ip string)

SetRemoteIP todo

func (*GrpcOutCtx) SetUserAgent added in v0.2.0

func (c *GrpcOutCtx) SetUserAgent(ua string)

SetUserAgent todo

type HTTPAPI

type HTTPAPI interface {
	Registry(router.SubRouter)
	Config() error
}

HTTPAPI restful 服务

type Service

type Service interface {
	Config() error
	HTTPEntry() *http.EntrySet
}

Service 注册上的服务必须实现的方法

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL