relay

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMakingRequest = errors.New("failed to make request")
	ErrNotOkResponse = errors.New("response not ok")
)

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController(log *logrus.Entry, queue *RemoteQueue) *Controller

func (*Controller) RelayRequest

func (c *Controller) RelayRequest(w http.ResponseWriter, r *http.Request)

type Orchestrator

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

func NewOrchestrator

func NewOrchestrator(log *logrus.Entry, queue *RemoteQueue, server *Server, selfProfiler StartStopper) *Orchestrator

func (*Orchestrator) Shutdown

func (o *Orchestrator) Shutdown() error

func (*Orchestrator) Start

func (o *Orchestrator) Start() error

type Relayer

type Relayer interface {
	Send(req *http.Request) error
}

type RemoteClient

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

func NewRemoteClient

func NewRemoteClient(log *logrus.Entry, config *RemoteClientCfg) *RemoteClient

func (*RemoteClient) Send

func (r *RemoteClient) Send(req *http.Request) error

Send relays the request to the remote server

type RemoteClientCfg

type RemoteClientCfg struct {
	// Address refers to the remote address the request will be made to
	Address             string
	AuthToken           string
	BasicAuthUser       string
	BasicAuthPassword   string
	TenantID            string
	HTTPHeadersJSON     string
	Timeout             time.Duration
	MaxIdleConnsPerHost int
	SessionID           string
}

type RemoteQueue

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

func NewRemoteQueue

func NewRemoteQueue(log *logrus.Entry, config *RemoteQueueCfg, relayer Relayer) *RemoteQueue

func (*RemoteQueue) Flush added in v1.3.0

func (r *RemoteQueue) Flush()

func (*RemoteQueue) Send

func (r *RemoteQueue) Send(req *http.Request) error

Send adds a request to the queue to be processed later

func (*RemoteQueue) Start

func (r *RemoteQueue) Start() error

func (*RemoteQueue) Stop

func (r *RemoteQueue) Stop(_ context.Context) error

Stop signals for the workers to not handle any more jobs Then waits for existing jobs to finish Currently context is not used for anything

type RemoteQueueCfg

type RemoteQueueCfg struct {
	NumWorkers int
}

type Server

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

func NewServer

func NewServer(logger *logrus.Entry, config *ServerCfg, handlerFunc http.HandlerFunc) *Server

func (*Server) Start

func (s *Server) Start() error

Start starts serving requests, this is a blocking operation

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

type ServerCfg

type ServerCfg struct {
	ServerAddress string
}

type StartStopper

type StartStopper interface {
	Start() error
	Stop(context.Context) error
}

Jump to

Keyboard shortcuts

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