Documentation ¶
Index ¶
- Variables
- func EthAddrFromAuthInfo(authInfo EthAuthInfo) (common.Address, error)
- func EthAddrFromContext(ctx context.Context) (common.Address, error)
- func EthAddrToContext(ctx context.Context, address common.Address) context.Context
- func Extract(ctx context.Context) string
- func NewStreamAuthenticator(authFunc grpc_auth.AuthFunc) grpc.StreamServerInterceptor
- func NewStreamPanic() grpc.StreamServerInterceptor
- func NewStreamSimpleTracer() grpc.StreamServerInterceptor
- func NewStreamZapLogger(logger *zap.Logger) grpc.StreamServerInterceptor
- func NewUnaryAuthenticator(authFunc grpc_auth.AuthFunc) grpc.UnaryServerInterceptor
- func NewUnaryPanic() grpc.UnaryServerInterceptor
- func NewUnarySimpleTracer() grpc.UnaryServerInterceptor
- func NewUnaryZapLogger(logger *zap.Logger) grpc.UnaryServerInterceptor
- func ToContext(ctx context.Context, requestID string) context.Context
- type EthAuthInfo
- type Frame
- type Stack
- type StackTrace
Constants ¶
This section is empty.
Variables ¶
var AuthFunc = func(ctx context.Context) (context.Context, error) { authInfo, err := AuthInfoFromContext(ctx) if err != nil { return nil, status.Errorf(codes.Unauthenticated, "invalid auth info: %v", err) } key, err := EthAddrFromAuthInfo(authInfo) if err != nil { return nil, status.Errorf(codes.Unauthenticated, "invalid key: %v", err) } return EthAddrToContext(ctx, key), nil }
AuthFunc default auth by ehtereum address.
Functions ¶
func EthAddrFromAuthInfo ¶
func EthAddrFromAuthInfo(authInfo EthAuthInfo) (common.Address, error)
EthAddrFromAuthInfo extracts eth addr from auth info.
func EthAddrFromContext ¶
EthAddrFromContext extracts eth address from the given context.
func EthAddrToContext ¶
EthAddrToContext puts the given eth address to the context.
func NewStreamAuthenticator ¶
func NewStreamAuthenticator(authFunc grpc_auth.AuthFunc) grpc.StreamServerInterceptor
NewStreamAuthenticator Creates new stream interceptor to authenticate requests.
func NewStreamPanic ¶
func NewStreamPanic() grpc.StreamServerInterceptor
NewStreamPanic Creates new stream interceptor to recover from panics.
func NewStreamSimpleTracer ¶
func NewStreamSimpleTracer() grpc.StreamServerInterceptor
NewStreamSimpleTracer Creates new stream interceptor for tracing requests.
func NewStreamZapLogger ¶
func NewStreamZapLogger(logger *zap.Logger) grpc.StreamServerInterceptor
NewStreamZapLogger Creates new stream interceptor for logging using zap.
func NewUnaryAuthenticator ¶
func NewUnaryAuthenticator(authFunc grpc_auth.AuthFunc) grpc.UnaryServerInterceptor
NewUnaryAuthenticator Creates new unary interceptor to authenticate requests.
func NewUnaryPanic ¶
func NewUnaryPanic() grpc.UnaryServerInterceptor
NewUnaryPanic Creates new unary interceptor to recover from panics.
func NewUnarySimpleTracer ¶
func NewUnarySimpleTracer() grpc.UnaryServerInterceptor
NewUnarySimpleTracer Creates new unary interceptor for tracing requests.
func NewUnaryZapLogger ¶
func NewUnaryZapLogger(logger *zap.Logger) grpc.UnaryServerInterceptor
NewUnaryZapLogger Creates new unary interceptor for logging using zap.
Types ¶
type EthAuthInfo ¶
type EthAuthInfo interface { credentials.AuthInfo WalletAddress() common.Address }
EthAuthInfo holds auth info containing ethereum address.
func AuthInfoFromContext ¶
func AuthInfoFromContext(ctx context.Context) (EthAuthInfo, error)
AuthInfoFromContext extracts eth address from the context.
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a Stack frame.
func (Frame) Format ¶
Format formats the frame according to the fmt.Formatter interface.
%s source file %d source line %n function name %v equivalent to %s:%d
Format accepts flags that alter the printing of some verbs, as follows:
%+s path of source file relative to the compile time GOPATH %+v equivalent to %+s:%d
nolint
type StackTrace ¶
type StackTrace []Frame
StackTrace is Stack of Frames from innermost (newest) to outermost (oldest).
func (StackTrace) Format ¶
func (st StackTrace) Format(s fmt.State, verb rune)
Format formats the Stack of Frames according to the fmt.Formatter interface.
%s lists source files for each Frame in the Stack %v lists the source file and line number for each Frame in the Stack
Format accepts flags that alter the printing of some verbs, as follows:
%+v Prints filename, function, and line number for each Frame in the Stack.
nolint