proxy

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderNameXProxqSource  = proxqtypes.HeaderNameXProxqSource
	HeaderNameXProxqTimeout = proxqtypes.HeaderNameXProxqTimeout
	HeaderValueProxq        = proxqtypes.HeaderValueProxq
)
View Source
const DefaultQueue = "default"
View Source
const TaskTypeName = "proxy:request"

Variables

This section is empty.

Functions

func RetryDelayFunc

func RetryDelayFunc(
	n int, _ error, t *asynq.Task,
) time.Duration

Types

type Handler

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

func NewHandler

func NewHandler(
	client *asynq.Client,
	cfg HandlerConfig,
) *Handler

func (*Handler) ServeHTTP

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

type HandlerConfig

type HandlerConfig struct {
	Upstreams     []UpstreamConfig
	Queue         string
	TaskRetention time.Duration
}

type JobsHandler

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

func NewJobsHandler

func NewJobsHandler(
	inspector *asynq.Inspector,
	queue string,
) *JobsHandler

func (*JobsHandler) Cancel

func (h *JobsHandler) Cancel(
	w http.ResponseWriter,
	r *http.Request,
)

func (*JobsHandler) Content

func (h *JobsHandler) Content(
	w http.ResponseWriter,
	r *http.Request,
)

func (*JobsHandler) Get

func (h *JobsHandler) Get(
	w http.ResponseWriter,
	r *http.Request,
)

type Status

type Status string
const (
	StatusQueued    Status = "queued"
	StatusRunning   Status = "running"
	StatusCompleted Status = "completed"
	StatusFailed    Status = "failed"
)

func StatusFromTaskState

func StatusFromTaskState(s asynq.TaskState) Status

type UpstreamConfig

type UpstreamConfig struct {
	Prefix                 string
	URL                    string
	Timeout                time.Duration
	MaxRetries             int
	RetryDelay             time.Duration
	MaxBodySize            int64
	DirectProxyThreshold   int64
	DirectProxyMode        string
	CacheKeyExcludeHeaders []string
	PathFilter             []*regexp.Regexp
	PathFilterMode         string
}

type Worker

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

func NewWorker

func NewWorker(cfg WorkerConfig) *Worker

func (*Worker) ProcessTask

func (w *Worker) ProcessTask(
	ctx context.Context,
	t *asynq.Task,
) error

type WorkerConfig

type WorkerConfig struct {
	UpstreamTimeout time.Duration
	Cache           cache.Cache
	CacheTTL        time.Duration
}

Jump to

Keyboard shortcuts

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