proxyc

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package proxyc implements a client to proxy requests to external services.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAvailableServer = errors.New(
		"failed to initialize servers. Require at least 1 server has URL",
	)
)

Functions

func BuildMetadataTree

func BuildMetadataTree(
	ctx context.Context,
	document *schema.RelyProxyAPIDocument,
	clientOptions *ProxyClientOptions,
) (*internal.Node, error)

BuildMetadataTree builds the metadata tree from the API document.

func ParseHTTPURL

func ParseHTTPURL(input string, bannedHosts []string) (*url.URL, error)

ParseHTTPURL parses and validates the HTTP URL.

Types

type ProxyClient

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

ProxyClient helps manage and execute REST and GraphQL APIs from the API document.

func NewProxyClient

func NewProxyClient(
	ctx context.Context,
	metadata *schema.RelyProxyAPIDocument,
	clientOptions *ProxyClientOptions,
) (*ProxyClient, error)

NewProxyClient creates a proxy client from the API document.

func (*ProxyClient) Close

func (pc *ProxyClient) Close() error

Close method performs cleanup and closure activities on the client instance.

func (*ProxyClient) Execute

func (pc *ProxyClient) Execute(
	ctx context.Context,
	req *http.Request,
) (*http.Response, any, error)

Execute routes and proxies the request to the remote server.

func (*ProxyClient) Metadata

func (pc *ProxyClient) Metadata() *schema.RelyProxyAPIDocument

Metadata returns the metadata of the proxy client.

type ProxyClientOptions

type ProxyClientOptions struct {
	*gohttpc.ClientOptions

	BasePath string
}

ProxyClientOptions holds optional options to create a proxy client.

Directories

Path Synopsis
handler
graphqlhandler
Package graphqlhandler evaluates and execute GraphQL requests to the remote server.
Package graphqlhandler evaluates and execute GraphQL requests to the remote server.
resthandler
Package resthandler evaluates and execute REST requests to the remote server.
Package resthandler evaluates and execute REST requests to the remote server.
Package internal implements internal functionality for the proxy client.
Package internal implements internal functionality for the proxy client.

Jump to

Keyboard shortcuts

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