agent

package
v0.1.47 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package agent implements the functions, types, and interfaces for the module.

Package agent implements the functions, types, and interfaces for the module.

Package agent implements the functions, types, and interfaces for the module.

Package agent implements the functions, types, and interfaces for the module.

Index

Constants

View Source
const ApiVersionV1 = "/api/v1"

ApiVersionV1 defines the version number of the API

View Source
const DefaultPrefix = "/api"

DefaultPrefix defines the default API prefix

View Source
const DefaultVersion = "v1"

DefaultVersion defines the default API version

Variables

View Source
var ErrContextNotFound = errors.New("http context not found")

Functions

func FromHTTPContext added in v0.1.44

func FromHTTPContext(ctx context.Context) (transhttp.Context, bool)

func HTTPContext added in v0.1.45

func HTTPContext(c transhttp.Context) context.Context

func NewHTTPContext added in v0.1.44

func NewHTTPContext(ctx context.Context, c transhttp.Context) context.Context

Types

type Agent

type Agent interface {
	HTTPAgent
	GRPCAgent
}

Agent is an interface that combines the HTTPAgent and GRPCAgent interfaces

var UnimplementedAgent Agent = &unimplementedAgent{}

func NewAgent added in v0.1.32

func NewAgent(httpServer *transhttp.Server, grpcServer *transgrpc.Server) Agent

NewAgent creates a new Agent instance that supports both HTTP and gRPC

func NewAgentWithGRPC added in v0.1.34

func NewAgentWithGRPC(grpcServer *transgrpc.Server) Agent

NewAgentWithGRPC creates a new Agent instance that only supports gRPC

func NewAgentWithHTTP added in v0.1.34

func NewAgentWithHTTP(server *transhttp.Server) Agent

NewAgentWithHTTP creates a new Agent instance that only supports HTTP

type GRPCAgent added in v0.1.32

type GRPCAgent interface {
	// Server returns an instance of the gRPC server
	Server() *transgrpc.Server
	// RegisterService registers a gRPC service
	RegisterService(desc *grpc.ServiceDesc, impl interface{})
}

GRPCAgent is an interface that defines the basic methods of a gRPC proxy

func NewGRPC added in v0.1.32

func NewGRPC(server *transgrpc.Server) GRPCAgent

type HTTPAgent added in v0.1.32

type HTTPAgent interface {
	// URI returns the URI of the HTTP service
	URI() string
	// HTTPServer returns an instance of the HTTP server
	HTTPServer() *transhttp.Server
	// Route returns an instance of the HTTP router
	Route() *transhttp.Router
}

HTTPAgent is an interface that defines the basic methods of an HTTP proxy

func NewHTTP added in v0.1.32

func NewHTTP(server *http.Server) HTTPAgent

Directories

Path Synopsis
middleware
security
Package security implements the functions, types, and interfaces for the module.
Package security implements the functions, types, and interfaces for the module.

Jump to

Keyboard shortcuts

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