streamcopy

package
v0.1.0-rc.40 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package streamcopy copies bytes in both directions and preserves half-closes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	LeftToRight int64
	RightToLeft int64
}

func Copy

func Copy(left, right net.Conn) (Result, error)

Copy waits for both directions and half-closes each destination when supported. the caller must close or set deadlines on the connections to cancel the copy. an unexpected error in either direction closes both connections.

func CopyObserved

func CopyObserved(
	left, right net.Conn,
	onLeftToRight, onRightToLeft func(int64),
) (Result, error)

CopyObserved is Copy with a callback after each write. the callbacks may run at the same time and must return quickly.

Jump to

Keyboard shortcuts

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