proxy

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	Logger: logr.Discard(),
	Client: &http.Client{},
}
View Source
var (
	ErrServiceNotRegistered = errors.New("service is not registered")
)

Functions

This section is empty.

Types

type HttpProxy

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

func New

func New(opts Options) *HttpProxy

func (*HttpProxy) Close

func (h *HttpProxy) Close()

func (*HttpProxy) RegisterOrUpdate

func (h *HttpProxy) RegisterOrUpdate(receiver Receiver) error

func (*HttpProxy) ServeHTTP

func (h *HttpProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HttpProxy) Unregister

func (h *HttpProxy) Unregister(path string) error

type Options

type Options struct {
	Logger logr.Logger
	Client *http.Client
}

type Receiver added in v1.0.0

type Receiver struct {
	Path          string
	Timeout       time.Duration
	Targets       []Target
	ResponseType  ResponseType
	BodySizeLimit int64
}

type ReportResponse added in v1.0.0

type ReportResponse struct {
	Targets []ReportTargetResponse `json:"targets"`
}

type ReportTargetResponse added in v1.0.0

type ReportTargetResponse struct {
	StatusCode int                 `json:"statusCode"`
	Body       string              `json:"body,omitempty"`
	Headers    map[string][]string `json:"headers,omitempty"`
}

type ResponseType added in v1.0.0

type ResponseType string
const (
	Async                    ResponseType = "Async"
	AwaitAllPreferSuccessful ResponseType = "AwaitAllPreferSuccessful"
	AwaitAllPreferFailed     ResponseType = "AwaitAllPreferFailed"
	AwaitAllReport           ResponseType = "AwaitAllReport"
)

type Target added in v1.0.0

type Target struct {
	Path             string
	Address          string
	Port             int32
	ServiceName      string
	ServiceNamespace string
	ResponseType     ResponseType
	BodySizeLimit    int64
}

Jump to

Keyboard shortcuts

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