proxy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ErrCodeParseError     = -32700
	ErrCodeInvalidRequest = -32600
	ErrCodeMethodNotFound = -32601
	ErrCodeInvalidParams  = -32602
	ErrCodeInternalError  = -32603
)

Variables

This section is empty.

Functions

func IsBatchRequest

func IsBatchRequest(data []byte) bool

Types

type JSONRPCError

type JSONRPCError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

func NewJSONRPCError

func NewJSONRPCError(code int, message string) *JSONRPCError

func (*JSONRPCError) Error

func (e *JSONRPCError) Error() string

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
	ID      interface{}     `json:"id"`
}

func ParseJSONRPCBatchRequest

func ParseJSONRPCBatchRequest(data []byte) ([]JSONRPCRequest, error)

func ParseJSONRPCRequest

func ParseJSONRPCRequest(data []byte) (*JSONRPCRequest, error)

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string          `json:"jsonrpc"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *JSONRPCError   `json:"error,omitempty"`
	ID      interface{}     `json:"id"`
}

func ParseJSONRPCResponse

func ParseJSONRPCResponse(data []byte) (*JSONRPCResponse, error)

type Proxy

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

func NewProxy

func NewProxy(upstreamAddr string, logger *slog.Logger) *Proxy

func (*Proxy) Close

func (p *Proxy) Close() error

func (*Proxy) Connect

func (p *Proxy) Connect(ctx context.Context) error

func (*Proxy) ForwardLoop

func (p *Proxy) ForwardLoop(ctx context.Context, ideConn net.Conn) error

func (*Proxy) ForwardLoopWithJSONRPC

func (p *Proxy) ForwardLoopWithJSONRPC(ctx context.Context, ideConn net.Conn) error

Jump to

Keyboard shortcuts

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