Help us shape the future of Go! Take the 2026 Go Developer Survey

protocol

package
v0.19.12 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package protocol implements the bounded, strict JSON stream used by Orb Bridge.

Index

Constants

View Source
const (
	Version    = "orb-bridge/1"
	Service    = "orb.instance/1"
	MaxFrame   = 1 << 20
	MaxRecord  = 16 << 10
	MaxDepth   = 64
	MaxPending = 64
	MaxPage    = 128
	MaxOutput  = 4 << 20
)

Variables

This section is empty.

Functions

func Canonical

func Canonical(b []byte) ([]byte, error)

Canonical implements RFC 8785 for object payloads. Counters remain strings; numeric values use IEEE 754 binary64, as required by JCS.

func Counter

func Counter(s string) (uint64, error)

func Decode

func Decode(b []byte, v any) error

Decode rejects unknown arguments as well as JSON ambiguities before binding a schema.

func NewID

func NewID() string

func PageLimit

func PageLimit(ctx context.Context) int

func Read

func Read(r io.Reader) ([]byte, error)

func ValidID

func ValidID(s string) bool

func WithPageLimit

func WithPageLimit(ctx context.Context, limit int) context.Context

func Write

func Write(w io.Writer, b []byte) error

Types

type Conn

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

func NewConn

func NewConn(stream io.ReadWriteCloser, handler Handler) *Conn

func (*Conn) Call

func (c *Conn) Call(ctx context.Context, method string, params, result any) error

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Done

func (c *Conn) Done() <-chan struct{}

func (*Conn) Invoke

func (c *Conn) Invoke(ctx context.Context, method string, params json.RawMessage) (json.RawMessage, error)

func (*Conn) SetFrameLimit

func (c *Conn) SetFrameLimit(limit int)

type RPCError

type RPCError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

func (*RPCError) Error

func (e *RPCError) Error() string

Jump to

Keyboard shortcuts

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