gateway

package
v0.0.0-...-c966403 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package gateway implements the HTTP gateway for Horizon. It is implemented as a library to allow for easy customisation.

Index

Constants

View Source
const HeaderAccount = "Hz-Account"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountsHandler

type AccountsHandler struct {
	Middleware chi.Middlewares
	Conn       *nats.Conn
	Auth       *auth.Auth
	Portals    map[string]hz.Portal
}

func (*AccountsHandler) Router

func (h *AccountsHandler) Router() *chi.Mux

type DefaultHandler

type DefaultHandler struct {
	Conn *nats.Conn
}

func (*DefaultHandler) GetAccounts

func (d *DefaultHandler) GetAccounts(w http.ResponseWriter, r *http.Request)

GetAccounts implements GatewayHandler.

func (*DefaultHandler) GetAccountsNew

func (d *DefaultHandler) GetAccountsNew(
	w http.ResponseWriter,
	r *http.Request,
)

GetAccountsNew implements GatewayHandler.

func (*DefaultHandler) GetHome

func (d *DefaultHandler) GetHome(w http.ResponseWriter, r *http.Request)

func (*DefaultHandler) PostAccounts

func (d *DefaultHandler) PostAccounts(w http.ResponseWriter, r *http.Request)

PostAccounts implements GatewayHandler.

type GatewayHandler

type GatewayHandler interface {
	GetHome(w http.ResponseWriter, r *http.Request)
	GetAccounts(w http.ResponseWriter, r *http.Request)
	GetAccountsNew(w http.ResponseWriter, r *http.Request)
	PostAccounts(w http.ResponseWriter, r *http.Request)
}

type NATSHTTPTransport

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

NATSHTTPTransport is an http.RoundTripper that transports HTTP requests over NATS.

It is used together with httputil.ReverseProxy to create an HTTP reverse proxy that transports requests over NATS.

func (*NATSHTTPTransport) RoundTrip

func (t *NATSHTTPTransport) RoundTrip(r *http.Request) (*http.Response, error)

type OIDCConfig

type OIDCConfig struct {
	Issuer       string
	ClientID     string
	ClientSecret string
	RedirectURL  string
}

type ObjectsHandler

type ObjectsHandler struct {
	Conn *nats.Conn
}

type Server

type Server struct {
	Conn *nats.Conn
	Auth *auth.Auth
	// contains filtered or unexported fields
}

func Start

func Start(
	ctx context.Context,
	conn *nats.Conn,
	auth *auth.Auth,
	opts ...ServerOption,
) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

type ServerOption

type ServerOption func(*serverOptions)

func WithDummyAuthDefault

func WithDummyAuthDefault(b bool) ServerOption

func WithDummyAuthUsers

func WithDummyAuthUsers(users ...storage.User) ServerOption

func WithOIDCConfig

func WithOIDCConfig(oidc OIDCConfig) ServerOption

func WithPort

func WithPort(port int) ServerOption

Directories

Path Synopsis
Package dummyoidc provides a dummy OIDC server/provider for dev and testing purposes.
Package dummyoidc provides a dummy OIDC server/provider for dev and testing purposes.

Jump to

Keyboard shortcuts

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