relay

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package relay provides bidirectional stream copying with an optional idle-timeout watchdog. Buffers are pooled to reduce allocations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Relay

func Relay(a, b io.ReadWriteCloser, timeout time.Duration, log *zap.Logger)

Relay copies data between a and b concurrently until either side closes.

If timeout > 0 an idle watchdog aborts both sides when no bytes are transferred for the timeout duration. For QUIC streams the watchdog uses CancelRead+CancelWrite so the peer observes a real stream-reset rather than a silent EOF. For non-QUIC RWCs the watchdog falls back to Close. Both a and b are always closed before Relay returns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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