codec

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Unlicense Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary interface {
	// MarshalBinary converts the data of the type into binary form, appending
	// it to the provided slice.
	MarshalBinary(dst []byte) (b []byte)
	// UnmarshalBinary decodes a binary form of a type back into the runtime
	// form, and returns whatever remains after the type has been decoded out.
	UnmarshalBinary(b []byte) (r []byte, err error)
}

Binary is a similarly simplified form of the stdlib binary Marshal/Unmarshal server. Same as JSON it does not have an error for the MarshalBinary.

type Envelope

type Envelope interface {
	// Label returns the (uppercase) string that signifies the type of message.
	Label() string
	// Write outputs the envelope to an io.Writer
	Write(w io.Writer) (err error)
	// JSON is a somewhat simplified version of the
	// json.Marshaler/json.Unmarshaler that has no error for the Marshal side of
	// the operation.
	JSON
}

Envelope is an interface for the nostr "envelope" message formats, a JSON array with the first field an upper case string that provides type information, in combination with the context of the side sending it (relay or client).

type I

type I interface {
	MarshalWrite(w io.Writer) (err error)
	UnmarshalRead(r io.Reader) (err error)
}

type JSON

type JSON interface {
	// Marshal converts the data of the type into JSON, appending it to the provided
	// slice and returning the extended slice.
	Marshal(dst []byte) (b []byte)
	// Unmarshal decodes a JSON form of a type back into the runtime form, and
	// returns whatever remains after the type has been decoded out.
	Unmarshal(b []byte) (r []byte, err error)
}

JSON is a somewhat simplified version of the json.Marshaler/json.Unmarshaler that has no error for the Marshal side of the operation.

Jump to

Keyboard shortcuts

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