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

sender

package
v1.36.185 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package sender provides p2p.Sender implementations over ZAP and gRPC transports.

ZAP is the default transport with zero-copy serialization and minimal overhead. gRPC support can be added with the grpc build tag for testing compatibility.

Build tags:

go build                  # ZAP only (default, production)
go build -tags=grpc       # gRPC support (for testing/compatibility)

Usage:

// ZAP transport (default)
s := sender.ZAP(zapConn)

// gRPC transport (requires -tags=grpc)
s := sender.GRPC(senderpb.NewSenderClient(grpcConn))

Both return p2p.Sender with identical behavior, just different wire protocol. ZAP provides ~5-10x faster serialization and ~30-50% lower CPU usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewZAPClient

func NewZAPClient(conn *zapwire.Conn) p2p.Sender

NewZAPClient is an alias for ZAP for backwards compatibility. Deprecated: Use ZAP() instead.

func ZAP

func ZAP(conn *zapwire.Conn) p2p.Sender

ZAP returns a p2p.Sender using ZAP transport.

Types

type ZAPServer

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

ZAPServer handles incoming ZAP sender messages and forwards them to warp.Sender

func NewZAPServer

func NewZAPServer(sender warp.Sender) *ZAPServer

NewZAPServer returns a ZAP server that wraps a warp.Sender

func (*ZAPServer) Handle

func (s *ZAPServer) Handle(ctx context.Context, msgType zapwire.MessageType, payload []byte) error

Handle routes a ZAP message to the appropriate handler

func (*ZAPServer) HandleSendError

func (s *ZAPServer) HandleSendError(ctx context.Context, payload []byte) error

HandleSendError handles a SendError message

func (*ZAPServer) HandleSendGossip

func (s *ZAPServer) HandleSendGossip(ctx context.Context, payload []byte) error

HandleSendGossip handles a SendGossip message

func (*ZAPServer) HandleSendRequest

func (s *ZAPServer) HandleSendRequest(ctx context.Context, payload []byte) error

HandleSendRequest handles a SendRequest message

func (*ZAPServer) HandleSendResponse

func (s *ZAPServer) HandleSendResponse(ctx context.Context, payload []byte) error

HandleSendResponse handles a SendResponse message

Jump to

Keyboard shortcuts

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