server

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPipeListenerClosed = errors.New(`pipe listener already closed`)

Functions

func StreamServerInterceptor

func StreamServerInterceptor(authFunc AuthFunc) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new unary server interceptors that performs per-request auth.

func UnaryServerInterceptor

func UnaryServerInterceptor(authFunc AuthFunc) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptors that performs per-request auth.

Types

type AuthFunc

type AuthFunc func(ctx context.Context, fullMethod string) (context.Context, error)

AuthFunc is the pluggable function that performs authentication.

The passed in `Context` will contain the gRPC metadata.MD object (for header-based authentication) and the peer.Peer information that can contain transport-based credentials (e.g. `credentials.AuthInfo`).

The returned context will be propagated to handlers, allowing user changes to `Context`. However, please make sure that the `Context` returned is a child `Context` of the one passed in.

If error is returned, its `grpc.Code()` will be returned to the user as well as the verbatim message. Please make sure you use `codes.Unauthenticated` (lacking auth) and `codes.PermissionDenied` (authed, but lacking perms) appropriately.

type PipeListener

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

func ListenPipe

func ListenPipe() *PipeListener

func (*PipeListener) Accept

func (l *PipeListener) Accept() (c net.Conn, e error)

Accept waits for and returns the next connection to the listener.

func (*PipeListener) Addr

func (l *PipeListener) Addr() net.Addr

Addr returns the listener's network address.

func (*PipeListener) Close

func (l *PipeListener) Close() (e error)

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*PipeListener) Dial

func (l *PipeListener) Dial(network, addr string) (net.Conn, error)

func (*PipeListener) DialContext

func (l *PipeListener) DialContext(ctx context.Context, network, addr string) (conn net.Conn, e error)

type Server

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

func NewServer

func NewServer(addr string, auth *configure.Auth) (s *Server, e error)

func (*Server) Serve

func (s *Server) Serve() (e error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) ServeTLS

func (s *Server) ServeTLS(certFile, keyFile string) (e error)

type ServiceAuthFuncOverride

type ServiceAuthFuncOverride interface {
	AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error)
}

ServiceAuthFuncOverride allows a given gRPC service implementation to override the global `AuthFunc`.

If a service implements the AuthFuncOverride method, it takes precedence over the `AuthFunc` method, and will be called instead of AuthFunc for all method invocations within that service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL