proxy

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	Name        string
	Source      string
	Destination string
	Show        bool
}

Proxy Route URL structure

type Server

type Server struct {

	//	It's inherently an HTTP server under the hood.
	*http.Server
	// contains filtered or unexported fields
}

Proxy Server

Fundamentally used for a reverse proxy by `dev` command.

func New

func New(config *ServerConfig) *Server

Intializes and returns a new functions server.

func (*Server) AddService

func (s *Server) AddService(service *Service)

Attaches a service to this server.

func (*Server) IssueAll

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

Issue proxy to all services attached to the server. Supports a custom connection multiplexer, and custom request context.

type ServerConfig

type ServerConfig struct {

	//	Base route on which the handle function should listen to.
	//	If not supplied, "/" is chosen by default.
	Handle string

	//	(Optional) Environment to attach to this server.
	Environment *environment.Environment

	//	Port on which to run the server
	Port string

	//	Server specific logger.
	//	In nil, then common Nhost logger is used.
	Log *logrus.Logger

	Mux *http.ServeMux

	//	(Optional) Do not delete the call logs on server shutdown.
	SaveLogs bool
}

Server configuration that the user can decide to load inside the functions server.

type Service

type Service struct {
	Name    string
	Address string
	Port    string
	Routes  []Route
	// contains filtered or unexported fields
}

func (*Service) Issue

func (s *Service) Issue(mux *http.ServeMux, ctx context.Context) error

Issues an HTTP and WS reverse proxy to the respective service. Supports a custom connection multiplexer, and custom request context.

Jump to

Keyboard shortcuts

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