api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAPIHandler

func RegisterAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAPIHandler registers the http handlers for service API to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAPIHandlerClient

func RegisterAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client extApi.APIClient) error

RegisterAPIHandlerClient registers the http handlers for service API to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "extApi.APIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "extApi.APIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "extApi.APIClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterAPIHandlerFromEndpoint

func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAPIHandlerFromEndpoint is same as RegisterAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAPIHandlerServer

func RegisterAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server extApi.APIServer) error

RegisterAPIHandlerServer registers the http handlers for service API to "mux". UnaryRPC :call APIServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAPIHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

Types

This section is empty.

Jump to

Keyboard shortcuts

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