page

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxWidth = 800
)

Variables

View Source
var (
	SelectorStrategyOptions = []ui_widget.MenuOption{
		{Key: i18n.SelectorRound, Value: "round"},
		{Key: i18n.SelectorRandom, Value: "rand"},
		{Key: i18n.SelectorFIFO, Value: "fifo"},
	}

	PluginTypeOptions = []ui_widget.MenuOption{
		{Key: i18n.PluginGRPC, Value: "grpc"},
		{Key: i18n.PluginHTTP, Value: "http"},
	}
	IPTypeOptions = []ui_widget.MenuOption{
		{Name: "IPv4", Value: "ipv4"},
		{Name: "IPv6", Value: "ipv6"},
	}
)

Functions

This section is empty.

Types

type Action

type Action string
const (
	ActionCreate Action = "create"
	ActionUpdate Action = "update"
	ActionDelete Action = "delete"
)

type AuthType

type AuthType string
const (
	AuthSimple AuthType = "simple"
	AuthAuther AuthType = "auther"
)

type C

type C = layout.Context

type Callback

type Callback func(action Action, id string, value any)

type D

type D = layout.Dimensions

type Event

type Event struct {
	ID EventID
}

type EventID

type EventID string
const (
	EventThemeChanged EventID = "event.theme.changed"
)

type Metadata

type Metadata struct {
	K string
	V string
}

type Page

type Page interface {
	Init(opts ...PageOption)
	Layout(gtx C) D
}

type PageMode

type PageMode string
const (
	BasicMode    PageMode = "basic"
	AdvancedMode PageMode = "advanced"
	PluginMode   PageMode = "plugin"
)

type PageOption

type PageOption func(opts *PageOptions)

func WithPageCallback

func WithPageCallback(cb Callback) PageOption

func WithPageID

func WithPageID(id string) PageOption

func WithPagePerm

func WithPagePerm(perm Perm) PageOption

func WithPageValue

func WithPageValue(v any) PageOption

type PageOptions

type PageOptions struct {
	ID       string
	Value    any
	Callback Callback
	Perm     Perm
}

type PagePath

type PagePath string
const (
	PageHome          PagePath = "/"
	PageServer        PagePath = "/server"
	PageService       PagePath = "/service"
	PageServiceRecord PagePath = "/service/record"
	PageChain         PagePath = "/chain"
	PageHop           PagePath = "/hop"
	PageNode          PagePath = "/node"
	PageForwarderNode PagePath = "/forwarder/node"
	PageAuther        PagePath = "/auther"
	PageAutherAuths   PagePath = "/auther/auths"
	PageMatcher       PagePath = "/matcher"
	PageAdmission     PagePath = "/admission"
	PageBypass        PagePath = "/bypass"
	PageResolver      PagePath = "/resolver"
	PageNameServer    PagePath = "/resolver/nameserver"
	PageHosts         PagePath = "/hosts"
	PageHostMapping   PagePath = "/hosts/mapping"
	PageLimiter       PagePath = "/limiter"
	PageLimit         PagePath = "/limiter/limit"
	PageObserver      PagePath = "/observer"
	PageRecorder      PagePath = "/recorder"
	PageEvent         PagePath = "/event"
	PageConfig        PagePath = "/config"
	PageSettings      PagePath = "/settings"
)

type Perm

type Perm uint8
const (
	PermRead   Perm = 1
	PermWrite  Perm = 2
	PermDelete Perm = 4

	PermReadWrite       Perm = PermRead | PermWrite
	PermReadWriteDelete Perm = PermReadWrite | PermDelete
)

type Route

type Route struct {
	Path     PagePath
	ID       string
	Value    any
	Callback Callback
	Perm     Perm
}

type Router

type Router struct {
	*material.Theme
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(w *app.Window, th *T) *Router

func (*Router) Back

func (r *Router) Back() (page Page)

func (*Router) Emit

func (r *Router) Emit(event Event)

func (*Router) Event

func (r *Router) Event() <-chan Event

func (*Router) Goto

func (r *Router) Goto(route Route)

func (*Router) HideModal

func (r *Router) HideModal(gtx C)

func (*Router) Layout

func (r *Router) Layout(gtx C) D

func (*Router) Notify

func (r *Router) Notify(message ui_widget.Message)

func (*Router) Register

func (r *Router) Register(path PagePath, page Page)

func (*Router) ShowModal

func (r *Router) ShowModal(gtx C, w func(gtx C, th *T) D)

type ServerEvent

type ServerEvent struct {
	Msg  string
	Time time.Time
}

type T

type T = material.Theme

Jump to

Keyboard shortcuts

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