zap

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package zap provides a ZAP binary protocol transport for Hanzo Base.

Instead of HTTP/JSON, clients can communicate with Base using the ZAP zero-copy binary protocol for significantly lower latency and memory usage.

Index

Constants

View Source
const (
	MsgTypeCollections uint16 = 100
	MsgTypeRecords     uint16 = 101
	MsgTypeAuth        uint16 = 102
	MsgTypeRealtime    uint16 = 103
)

ZAP message types for Base operations.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(app core.App)

MustRegister registers the ZAP transport plugin with a Base app. Call this before app.Start().

func MustRegisterWithConfig

func MustRegisterWithConfig(app core.App, config Config)

MustRegisterWithConfig registers the ZAP transport plugin with custom config.

Types

type Config

type Config struct {
	// Port to listen on for ZAP connections (default 9652).
	Port int

	// ServiceType for mDNS discovery (default "_hanzo-base._tcp").
	ServiceType string

	// NodeID for ZAP peer identification (default hostname-based).
	NodeID string

	// Enabled controls whether the ZAP listener starts (default true).
	Enabled bool
}

Config for the ZAP transport plugin.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults.

Jump to

Keyboard shortcuts

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