Debian Codegraph @

plumbing/protocol/packp/sideband/common.go

raw
1 package sideband
2
3 // Type sideband type "side-band" or "side-band-64k"
4 type Type int8
5
6 const (
7 // Sideband legacy sideband type up to 1000-byte messages
8 Sideband Type = iota
9 // Sideband64k sideband type up to 65519-byte messages
10 Sideband64k Type = iota
11
12 // MaxPackedSize for Sideband type
13 MaxPackedSize = 1000
14 // MaxPackedSize64k for Sideband64k type
15 MaxPackedSize64k = 65520
16 )
17
18 // Channel sideband channel
19 type Channel byte
20
21 // WithPayload encode the payload as a message
22 func (ch Channel) WithPayload(payload []byte) []byte {
23 return append([]byte{byte(ch)}, payload...)
24 }
25
26 const (
27 // PackData packfile content
28 PackData Channel = 1
29 // ProgressMessage progress messages
30 ProgressMessage Channel = 2
31 // ErrorMessage fatal error message just before stream aborts
32 ErrorMessage Channel = 3
33 )