http

package
v0.0.0-...-140e820 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package http provides HTTP server implementation for the protocol adapter.

Index

Constants

View Source
const (
	// AgenkitVersion is the current version of the Agenkit library
	AgenkitVersion = "0.44.0"
)

Variables

This section is empty.

Functions

func ParseHTTPEndpoint

func ParseHTTPEndpoint(endpoint string) (string, error)

ParseHTTPEndpoint parses an HTTP endpoint string. Format: http://host:port or https://host:port

Types

type HTTPAgent

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

HTTPAgent is an HTTP server wrapper for exposing agents over HTTP.

func NewHTTPAgent

func NewHTTPAgent(agent agenkit.Agent, addr string) *HTTPAgent

NewHTTPAgent creates a new HTTP agent server with default options (HTTP/1.1 only). Security: Default middleware (rate limiting, timeout) is enabled for protection.

Args:

  • agent: The local agent to expose
  • addr: HTTP server address (e.g., "localhost:8080")

func NewHTTPAgentWithOptions

func NewHTTPAgentWithOptions(agent agenkit.Agent, addr string, options ServerOptions) *HTTPAgent

NewHTTPAgentWithOptions creates a new HTTP agent server with custom options.

Args:

  • agent: The local agent to expose
  • addr: HTTP server address (e.g., "localhost:8080")
  • options: Server configuration options

func (*HTTPAgent) Start

func (h *HTTPAgent) Start(ctx context.Context) error

Start starts the HTTP server (and HTTP/3 if enabled).

func (*HTTPAgent) Stop

func (h *HTTPAgent) Stop() error

Stop stops the HTTP server (and HTTP/3 if enabled).

type ServerOptions

type ServerOptions struct {
	// EnableHTTP2 enables HTTP/2 support (both h2 and h2c)
	EnableHTTP2 bool
	// EnableHTTP3 enables HTTP/3 over QUIC (requires TLS)
	EnableHTTP3 bool
	// TLSConfig for HTTPS, HTTP/2 over TLS, and HTTP/3
	TLSConfig *tls.Config
	// HTTP3Addr is the UDP address for HTTP/3 (defaults to HTTP addr)
	HTTP3Addr string
	// EnableDefaultMiddleware enables default security middleware (rate limiting, timeout)
	// Defaults to true for secure-by-default operation
	EnableDefaultMiddleware bool
	// RateLimitConfig custom rate limiter configuration (uses secure defaults if nil)
	RateLimitConfig *middleware.RateLimiterConfig
	// TimeoutConfig custom timeout configuration (uses 30s default if nil)
	TimeoutConfig *middleware.TimeoutConfig
}

ServerOptions configures HTTP server behavior.

Jump to

Keyboard shortcuts

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