grpcutil

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetadataAuthorization string = "Authorization"
)

Variables

This section is empty.

Functions

func BuildAuthorization

func BuildAuthorization(username, password string) string

func ParseAuthorization

func ParseAuthorization(auth string, fc BasicAuthFunc) bool

Types

type BasicAuth

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

func NewBasicAuth

func NewBasicAuth(fc BasicAuthFunc) *BasicAuth

func (BasicAuth) Stream

func (a BasicAuth) Stream(
	srv any,
	ss grpc.ServerStream,
	_ *grpc.StreamServerInfo,
	handler grpc.StreamHandler,
) error

func (BasicAuth) Unary

func (a BasicAuth) Unary(
	ctx context.Context,
	req any,
	_ *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (any, error)

type BasicAuthClient

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

func NewBasicAuthClient

func NewBasicAuthClient(username, password string) *BasicAuthClient

func (BasicAuthClient) Stream

func (c BasicAuthClient) Stream(
	ctx context.Context,
	desc *grpc.StreamDesc,
	cc *grpc.ClientConn,
	method string,
	streamer grpc.Streamer,
	opts ...grpc.CallOption,
) (grpc.ClientStream, error)

func (BasicAuthClient) Unary

func (c BasicAuthClient) Unary(
	ctx context.Context,
	method string, req, reply any,
	cc *grpc.ClientConn,
	invoker grpc.UnaryInvoker,
	opts ...grpc.CallOption,
) error

type BasicAuthFunc

type BasicAuthFunc func(username, password string) bool

func NewMemoryBasicAuthFunc

func NewMemoryBasicAuthFunc(users map[string]string) BasicAuthFunc

Jump to

Keyboard shortcuts

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