httpstream

package
v0.0.0-...-6f916ce Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackgroundOnce

func BackgroundOnce[A, B any](f func() (A, B)) func() (A, B)

BackgroundOnce executes a function in a background goroutine and caches its result. The result can be retrieved multiple times, and each retrieval will wait for the function to complete if it hasn't already.

Types

type ProxyClient

type ProxyClient *http.Client // new type to force usage of NewProxiedClient

func NewProxiedClient

func NewProxiedClient() ProxyClient

type RequestStreamHandler

type RequestStreamHandler struct {
	TargetURI                  string
	ProxyURI                   *url.URL
	ResponseAuthorizationToken string // For POST request to send responses
	RequestAuthorizationToken  string // For GET request to receive client data
	// contains filtered or unexported fields
}

RequestStreamHandler handles HTTP streams using separate GET and POST requests for receiving client request data and sending client responses respectively

func NewRequestStreamHandler

func NewRequestStreamHandler(ctx context.Context, sharedProxyClient ProxyClient, statelessConfig *pb.WorkerInvokeFunctionRequest_StatelessConfig, requestDataWritable *pb.WorkerInvokeFunctionRequest) (*RequestStreamHandler, error)

NewRequestStreamHandler connects to the target URI using separate GET and POST connections

func (*RequestStreamHandler) Close

func (s *RequestStreamHandler) Close() error

Close closes the pipe writer and response body

func (*RequestStreamHandler) GetClientRequestBody

func (s *RequestStreamHandler) GetClientRequestBody() (io.ReadCloser, error)

GetClientRequestBody returns the upstream (ie the end user client) request body and any error encountered during request setup it is only valid to call this function once as the returned reader is shared.

func (*RequestStreamHandler) SendResponse

func (s *RequestStreamHandler) SendResponse(ctx context.Context, resp *http.Response, onFinishWrite func()) error

SendResponse writes the HTTP response to the invocation service it is only valid to call this function once

Jump to

Keyboard shortcuts

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