adapter

package
v4.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CheckInterval represents the time interval of running check.
	CheckInterval = time.Second
)

Functions

func GenDashboardConfig added in v4.0.1

func GenDashboardConfig(srv *server.Server) (*config.Config, error)

GenDashboardConfig generates a configuration for Dashboard Server.

Types

type Manager

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

Manager is used to control dashboard.

func NewManager

func NewManager(srv *server.Server, s *apiserver.Service, redirector *Redirector) *Manager

NewManager creates a new Manager.

func (*Manager) Start

func (m *Manager) Start()

Start monitoring the dynamic config and control the dashboard.

func (*Manager) Stop

func (m *Manager) Stop()

Stop monitoring the dynamic config and control the dashboard.

type Redirector

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

Redirector is used to redirect when the dashboard is started in another PD.

func NewRedirector

func NewRedirector(name string, tlsConfig *tls.Config) *Redirector

NewRedirector creates a new Redirector.

func (*Redirector) GetAddress

func (h *Redirector) GetAddress() string

GetAddress is used to get the address to be redirected.

func (*Redirector) GetProxy

func (h *Redirector) GetProxy() *httputil.ReverseProxy

GetProxy is used to get the reverse proxy arriving at address.

func (*Redirector) NewStatusAwareHandler added in v4.0.1

func (h *Redirector) NewStatusAwareHandler(handler http.Handler) http.Handler

NewStatusAwareHandler returns a Handler that switches between different Handlers based on status.

func (*Redirector) ReverseProxy

func (h *Redirector) ReverseProxy(w http.ResponseWriter, r *http.Request)

ReverseProxy forwards the request to address and returns the response to the client.

func (*Redirector) SetAddress

func (h *Redirector) SetAddress(addr string)

SetAddress is used to set a new address to be redirected.

func (*Redirector) TemporaryRedirect

func (h *Redirector) TemporaryRedirect(w http.ResponseWriter, r *http.Request)

TemporaryRedirect sends the status code 307 to the client, and the client redirects itself.

Jump to

Keyboard shortcuts

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