pktline

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pktline reads and writes the pkt-line framing of the git wire protocols.

Index

Constants

View Source
const MaxData = 65516

MaxData is the most data bytes of one packet.

Variables

View Source
var ErrMalformed = errors.New("pktline: malformed packet")

Functions

func SideBand

func SideBand(w *Writer) io.Writer

SideBand returns a writer that sends what it gets as packets of band 1.

Types

type Kind

type Kind int
const (
	Data Kind = iota
	Flush
	Delim
	ResponseEnd
)

type Reader

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

Reader reads packets from r.

func NewReader

func NewReader(r io.Reader) *Reader

func (*Reader) Next

func (r *Reader) Next() ([]byte, Kind, error)

Next returns the next packet. The data is valid until the next call. A clean end of input before a packet is io.EOF.

type Writer

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

Writer writes packets to w and keeps the first error.

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) Data

func (w *Writer) Data(b []byte)

Data writes one packet of at most MaxData bytes.

func (*Writer) Delim

func (w *Writer) Delim()

func (*Writer) Err

func (w *Writer) Err() error

Err is the first write error.

func (*Writer) Flush

func (w *Writer) Flush()

func (*Writer) Linef

func (w *Writer) Linef(format string, args ...any)

Linef writes one packet of formatted text.

Jump to

Keyboard shortcuts

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