rpcutils

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserTypeNone      = "none"
	UserTypeAdmin     = "admin"
	UserTypeUser      = "user"
	UserTypeProvider  = "provider"
	UserTypeNode      = "node"
	UserTypeCluster   = "cluster"
	UserTypeStat      = "stat"
	UserTypeDNS       = "dns"
	UserTypeLog       = "log"
	UserTypeAPI       = "api"
	UserTypeAuthority = "authority"
	UserTypeReport    = "report"
)

Variables

This section is empty.

Functions

func IsRest added in v0.5.3

func IsRest(ctx context.Context) bool

func NewMockAdminNodeContext

func NewMockAdminNodeContext(adminId int64) context.Context

func NewMockNodeContext

func NewMockNodeContext(nodeId int64) context.Context

func Wrap

func Wrap(description string, err error) error

Wrap 包装错误

Types

type MockAdminNodeContext

type MockAdminNodeContext struct {
	context.Context

	AdminId int64
}

type MockNodeContext

type MockNodeContext struct {
	context.Context

	NodeId int64
}

type PlainContext

type PlainContext struct {
	UserType string
	UserId   int64
	// contains filtered or unexported fields
}

func NewPlainContext

func NewPlainContext(userType string, userId int64) *PlainContext

func (*PlainContext) Deadline

func (this *PlainContext) Deadline() (deadline time.Time, ok bool)

func (*PlainContext) Done

func (this *PlainContext) Done() <-chan struct{}

func (*PlainContext) Err

func (this *PlainContext) Err() error

func (*PlainContext) Value

func (this *PlainContext) Value(key interface{}) interface{}

type UserType

type UserType = string

func ValidateRequest

func ValidateRequest(ctx context.Context, userTypes ...UserType) (userType UserType, resultNodeId int64, userId int64, err error)

ValidateRequest 校验请求

Jump to

Keyboard shortcuts

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