ui

package
v0.0.0-...-109c5d9 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const EV_BUFFER = 200

TODO: circular buffer, poll event, for debug

Variables

This section is empty.

Functions

func Dir

func Dir(useLocal bool, name string) http.FileSystem

Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.

func FS

func FS(useLocal bool) http.FileSystem

FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSByte

func FSByte(useLocal bool, name string) ([]byte, error)

FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSMustByte

func FSMustByte(useLocal bool, name string) []byte

FSMustByte is the same as FSByte, but panics if name is not present.

func FSMustString

func FSMustString(useLocal bool, name string) string

FSMustString is the string version of FSMustByte.

func FSString

func FSString(useLocal bool, name string) (string, error)

FSString is the string version of FSByte.

func IP6

func IP6(n *ugate.DMNode) net.IP

func NodeID

func NodeID(n *ugate.DMNode) string

func QuitHandler

func QuitHandler(writer http.ResponseWriter, request *http.Request)

func Since

func Since(n time.Time) string

func ToJson

func ToJson(n interface{}) string

Types

type DMUI

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

UI and admin interface. Exposed via localhost only. TODO: add a random password and cookie

func NewUI

func NewUI(dm *mesh.Gateway, h2 *h2.H2, hgate *httpproxy.HTTPGate) (*DMUI, error)

func (*DMUI) DebugEventsHandler

func (lm *DMUI) DebugEventsHandler(w http.ResponseWriter, req *http.Request)

Return the sticky and recent events.

func (*DMUI) HttpRefreshAndRegister

func (lm *DMUI) HttpRefreshAndRegister(w http.ResponseWriter, r *http.Request)

HttpRefreshAndRegister (/dmesh/rd) will initiate a multicast UDP, asking for local masters. After a small wait it'll return the list of peers. Debugging only.

func (*DMUI) Merge

func (ui *DMUI) Merge(s string) func(http.ResponseWriter, *http.Request)

Render a template s. Will merge a base.html template first.

func (*DMUI) ServeHTTP

func (dm *DMUI) ServeHTTP(w http.ResponseWriter, r *http.Request)

Default handler - operating as main admin handlers, on localhost

Host headers: - NODEID.dm -> forwarded to node, using connected client or parent. - configured host -> forwarded via HTTP/1.1 or H2, local named hosts

Jump to

Keyboard shortcuts

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