transparent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package transparent provides MCP ping functionality for transparent proxies.

Package transparent provides a transparent HTTP proxy implementation that forwards requests to a destination without modifying them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMCPPinger added in v0.0.46

func NewMCPPinger(targetURL string) healthcheck.MCPPinger

NewMCPPinger creates a new MCP pinger for transparent proxies

Types

type MCPPinger added in v0.0.46

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

MCPPinger implements healthcheck.MCPPinger for transparent proxies

func (*MCPPinger) Ping added in v0.0.46

func (p *MCPPinger) Ping(ctx context.Context) (time.Duration, error)

Ping performs a simple HTTP health check for SSE transport servers For SSE transport, we don't send MCP ping requests because that would require establishing an SSE session first. Instead, we do a simple HTTP GET to check if the server is responding.

type TransparentProxy

type TransparentProxy struct {

	// If mcp server has been initialized
	IsServerInitialized bool
	// contains filtered or unexported fields
}

TransparentProxy implements the Proxy interface as a transparent HTTP proxy that forwards requests to a destination. It's used by the SSE transport to forward requests to the container's HTTP server.

func NewTransparentProxy

func NewTransparentProxy(
	host string,
	port int,
	containerName string,
	targetURI string,
	prometheusHandler http.Handler,
	authInfoHandler http.Handler,
	enableHealthCheck bool,
	isRemote bool,
	transportType string,
	middlewares ...types.NamedMiddleware,
) *TransparentProxy

NewTransparentProxy creates a new transparent proxy with optional middlewares.

func (*TransparentProxy) CloseListener added in v0.2.1

func (p *TransparentProxy) CloseListener() error

CloseListener closes the listener for the transparent proxy.

func (*TransparentProxy) ForwardResponseToClients

func (*TransparentProxy) ForwardResponseToClients(_ context.Context, _ jsonrpc2.Message) error

ForwardResponseToClients forwards a response from the destination to clients. This is not used in the TransparentProxy implementation as it forwards HTTP requests directly.

func (*TransparentProxy) GetMessageChannel

func (*TransparentProxy) GetMessageChannel() chan jsonrpc2.Message

GetMessageChannel returns the channel for messages to/from the destination. This is not used in the TransparentProxy implementation as it forwards HTTP requests directly.

func (*TransparentProxy) IsRunning

func (p *TransparentProxy) IsRunning(_ context.Context) (bool, error)

IsRunning checks if the proxy is running.

func (*TransparentProxy) SendMessageToDestination

func (*TransparentProxy) SendMessageToDestination(_ jsonrpc2.Message) error

SendMessageToDestination sends a message to the destination. This is not used in the TransparentProxy implementation as it forwards HTTP requests directly.

func (*TransparentProxy) Start

func (p *TransparentProxy) Start(ctx context.Context) error

Start starts the transparent proxy. nolint:gocyclo // This function handles multiple startup scenarios and is complex by design

func (*TransparentProxy) Stop

func (p *TransparentProxy) Stop(ctx context.Context) error

Stop stops the transparent proxy.

Jump to

Keyboard shortcuts

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