labels

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: CC0-1.0, MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EVENT  = string(List[LEvent])
	OK     = string(List[LOK])
	REQ    = string(List[LReq])
	NOTICE = string(List[LNotice])
	EOSE   = string(List[LEOSE])
	CLOSE  = string(List[LClose])
	CLOSED = string(List[LClosed])
	COUNT  = string(List[LCount])
	AUTH   = string(List[LAuth])
)

With these, labels have easy short names for the strings, as well as neat consistent 1 byte enum version. Having all 3 versions also makes writing the recogniser easier.

View Source
var List = EnvelopeLabel{
	LNil:    nil,
	LEvent:  []byte("EVENT"),
	LOK:     []byte("OK"),
	LNotice: []byte("NOTICE"),
	LEOSE:   []byte("EOSE"),
	LClose:  []byte("CLOSE"),
	LClosed: []byte("CLOSED"),
	LReq:    []byte("REQ"),
	LCount:  []byte("COUNT"),
	LAuth:   []byte("AUTH"),
}

List is the nip1 envelope labels, matching the above enums.

Functions

This section is empty.

Types

type EnvelopeLabel

type EnvelopeLabel map[T][]byte

func (EnvelopeLabel) String

func (l EnvelopeLabel) String() (s string)

type T

type T = byte
const (
	LNil T = iota
	LEvent
	LOK
	LNotice
	LEOSE
	LClose
	LClosed
	LReq
	LCount
	LAuth
)

T enums for compact identification of the label.

func GetLabel

func GetLabel(s string) (l T)

Jump to

Keyboard shortcuts

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