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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustRegister ¶
MustRegister registers the ZAP transport plugin with a Base app. Call this before app.Start().
func MustRegisterWithConfig ¶
MustRegisterWithConfig registers the ZAP transport plugin with custom config.
Types ¶
type Config ¶
type Config struct {
// Port to listen on for ZAP connections (default 9999).
Port int
// Address is the host:port to listen on, overriding Port (default
// ZAP_ADDR). Empty means the HTTP server's host on Port, so a Base
// serving HTTP on loopback serves ZAP on loopback too. ":9999" is every
// interface, which is only what an operator gets by writing it.
Address string
// NoMDNS stops the node advertising itself on the LAN and dialling the
// peers it finds there. A node on a loopback address never runs mDNS:
// no peer that learned of it could reach it.
NoMDNS bool
// 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.
Click to show internal directories.
Click to hide internal directories.