models

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port     string `json:"port" default:"8080"`
	TLSPort  string `json:"tlsPort" default:"6443"`
	UUID     string `json:"uuid,omitempty"`
	Name     string `json:"name,omitempty"`
	Host     string `json:"host,omitempty"`
	LogLevel string `json:"logLevel,omitempty"`

	// Version is used as command line flag to print version
	Version bool `json:"version,omitempty" flagUsage:"show the version of the app without starting"`

	// StaticRoot can be used to set directory for the web ui. defaults to the one compiled with statik in statik folder. used for dev purposes.
	StaticRoot string `json:"staticRoot"`

	// ProxyTLSPort is used to signal the insecurewebsocket port to advertise a tlsport on a proxy
	ProxyTLSPort string `json:"proxyTLSPort"`
}

Config is the main server configuration.

func (*Config) Load

func (c *Config) Load() error

Load loads the config using multiconfig from json or environment or command line args but does not fatal as MustLoad does.

func (*Config) MustLoad

func (c *Config) MustLoad()

MustLoad loads the config using multiconfig from json or environment or command line args.

func (*Config) Save

func (c *Config) Save(filename string)

Save writes the config as json to specified filename.

type Connection

type Connection struct {
	Type       string                 `json:"type"`
	RemoteAddr string                 `json:"remoteAddr"`
	NodeUuid   string                 `json:"nodeUuid,omitEmpty"`
	Attributes map[string]interface{} `json:"attributes"`

	Session *melody.Session `json:"-"`
}

type Labels

type Labels map[string]string

type Message

type Message struct {
	FromUUID string          `json:"fromUUID,omitempty"`
	Type     string          `json:"type"`
	Body     json.RawMessage `json:"body,omitempty"`
	Request  json.RawMessage `json:"request,omitempty"`
}

func NewMessage

func NewMessage(t string, body interface{}) (*Message, error)

func ParseMessage

func ParseMessage(msg []byte) (*Message, error)

func (*Message) Encode

func (m *Message) Encode() ([]byte, error)

func (*Message) String

func (m *Message) String() string

func (*Message) WriteTo

func (m *Message) WriteTo(s interfaces.MelodyWriter) error

func (*Message) WriteWithFilter

func (m *Message) WriteWithFilter(mel *melody.Melody, f func(s *melody.Session) bool) error

type Node

type Node struct {
	UUID       string     `json:"uuid,omitempty"`
	Connected_ bool       `json:"connected,omitempty"`
	Build      build.Data `json:"build,omitempty"`
	Type       string     `json:"type,omitempty"`
	Name       string     `json:"name,omitempty"`
	// Devices   Devices         `json:"devices,omitempty"`
	Config  json.RawMessage       `json:"config,omitempty"`
	Aliases map[devices.ID]string `json:"aliases,omitempty"`
	sync.Mutex
}

func (*Node) Alias

func (n *Node) Alias(id devices.ID) string

func (*Node) Connected

func (n *Node) Connected() bool

func (*Node) SetAlias

func (n *Node) SetAlias(id devices.ID, alias string)

func (*Node) SetConnected

func (n *Node) SetConnected(c bool)

type ReadyInfo

type ReadyInfo struct {
	Method string          `json:"method"`
	User   *persons.Person `json:"user"`
}

type Request

type Request struct {
	Version string `json:"version,omitempty"`
	Type    string `json:"type,omitempty"`
	CSR     string `json:"csr"`
}

type ServerInfo

type ServerInfo struct {
	Name       string `json:"name"`
	UUID       string `json:"uuid"`
	TLSPort    string `json:"tlsPort"`
	Port       string `json:"port"`
	Init       bool   `json:"init"`
	AllowLogin bool   `json:"allowLogin"`
}

Directories

Path Synopsis
nx

Jump to

Keyboard shortcuts

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