proxy

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSignedCert

func GenSignedCert() (keyPem []byte, certPem []byte, err error)

GenSignedCert generates a key and cert pair, signed by the master CA cert.

func InitProxy

func InitProxy(httpAuth ProxyHTTPAuth)

InitProxy initializes the global proxy.

func LoadOrGenCA

func LoadOrGenCA() error

LoadOrGenCA generates a new CA cert and key if they do not exist in DB or are expired.

func LoadOrGenSignedMasterCert

func LoadOrGenSignedMasterCert() error

LoadOrGenSignedMasterCert generates a new master cert and key if they do not exist in DB or are expired.

func MasterCACert

func MasterCACert() ([]byte, error)

MasterCACert returns the CA cert.

func MasterKeyAndCert

func MasterKeyAndCert() (keyPem []byte, certPem []byte, err error)

MasterKeyAndCert returns the key and cert, signed by CA, that Master uses.

func VerifyMasterSigned

func VerifyMasterSigned(state tls.ConnectionState) error

VerifyMasterSigned checks the offered certificate to ensure that it was signed by the master CA.

Types

type Proxy

type Proxy struct {
	HTTPAuth ProxyHTTPAuth
	// contains filtered or unexported fields
}

Proxy is an actor that proxies requests to registered services.

var DefaultProxy *Proxy

DefaultProxy is the global proxy singleton.

func (*Proxy) ClearProxy

func (p *Proxy) ClearProxy()

ClearProxy erases all services from the proxy in case any handlers are still active.

func (*Proxy) GetService

func (p *Proxy) GetService(serviceID string) *Service

GetService returns the Service, if any, given the serviceID key.

func (*Proxy) NewProxyHandler

func (p *Proxy) NewProxyHandler(serviceID string) echo.HandlerFunc

NewProxyHandler returns a middleware function for proxying HTTP-like traffic to services running in the cluster. Services an HTTP request through the /proxy/:service/* route.

func (*Proxy) Register

func (p *Proxy) Register(serviceID string, url *url.URL, proxyTCP bool, unauth bool)

Register registers the service name with the associated target URL. All requests with the format ".../:service-name/*" are forwarded to the service via the target URL.

func (*Proxy) Summaries

func (p *Proxy) Summaries() map[string]Service

Summaries returns a snapshot of the registered services.

func (*Proxy) Summary

func (p *Proxy) Summary(id string) (Service, bool)

Summary returns a snapshot of a specific registered service.

func (*Proxy) Unregister

func (p *Proxy) Unregister(serviceID string)

Unregister removes the service from the proxy. All future requests until the service name is registered again will be responded with a 404 response. If the service is not registered with the proxy, the message is ignored.

type ProxyHTTPAuth

type ProxyHTTPAuth func(echo.Context) (done bool, err error)

ProxyHTTPAuth processes a proxy request, returning true if the request should terminate immediately and an error if one was encountered during authentication.

type Service

type Service struct {
	URL                  *url.URL
	LastRequested        time.Time
	ProxyTCP             bool
	AllowUnauthenticated bool
}

Service represents a registered service. The LastRequested field is used by the Tensorboard manager to spin down idle instances of Tensorboard.

func (Service) Clone

func (s Service) Clone() Service

Clone returns a deep copy of the Service.

Jump to

Keyboard shortcuts

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