Antonio Mika
·
2026-10-09
1package rsync
2
3// Protocol versions this implementation speaks. 27 is rsync 2.6.0 and 31 is
4// what every rsync since 3.1.0 negotiates down to.
5const (
6 minProtocol = 27
7 maxProtocol = 31
8)
9
10// File-list transmission flags (rsync.h XMIT_*).
11const (
12 xmitTopDir = 1 << 0
13 xmitSameMode = 1 << 1
14 xmitSameRdevPre28 = 1 << 2
15 xmitExtendedFlags = 1 << 2
16 xmitSameUID = 1 << 3
17 xmitSameGID = 1 << 4
18 xmitSameName = 1 << 5
19 xmitLongName = 1 << 6
20 xmitSameTime = 1 << 7
21 xmitSameRdevMajor = 1 << 8
22 xmitNoContentDir = 1 << 8
23 xmitHlinked = 1 << 9
24 xmitUserNameFollows = 1 << 10
25 xmitRdevMinor8Pre30 = 1 << 11
26 xmitGroupNameFollows = 1 << 11
27 xmitHlinkFirst = 1 << 12
28 xmitIOErrorEndList = 1 << 12
29 xmitModNsec = 1 << 13
30 xmitSameAtime = 1 << 14
31)
32
33// Sizes and limits (rsync.h).
34const (
35 maxPathLen = 4096
36 maxWireNsec = 999999999
37 blockSize = 700
38 maxBlockSize = 1 << 17
39 oldMaxBlockSize = 1 << 29
40 chunkSize = 32 * 1024
41 maxMapSize = 256 * 1024
42 sumLength = 16
43 shortSumLength = 2
44 blocksumBias = 10
45 maxDataCount = 16383
46 mplexBase = 7
47 maxChainLen = 1024
48 traditionalTableSize = 1 << 16
49)
50
51// Unix file type bits as sent on the wire.
52const (
53 sIFMT = 0o170000
54 sIFSOCK = 0o140000
55 sIFLNK = 0o120000
56 sIFREG = 0o100000
57 sIFBLK = 0o060000
58 sIFDIR = 0o040000
59 sIFCHR = 0o020000
60 sIFIFO = 0o010000
61)
62
63// Item flags sent alongside a file index (rsync.h ITEM_*).
64const (
65 itemReportChange = 1 << 1
66 itemReportSize = 1 << 2
67 itemReportTime = 1 << 3
68 itemBasisTypeFollows = 1 << 11
69 itemXnameFollows = 1 << 12
70 itemIsNew = 1 << 13
71 itemTransfer = 1 << 15
72 itemMissingData = 1 << 16
73)
74
75// Basis file types sent with itemBasisTypeFollows.
76const (
77 fnamecmpFname = 0x80
78 fnamecmpPartialDir = 0x81
79)
80
81// Multiplexed message tags (rsync.h enum msgcode).
82const (
83 msgData = 0
84 msgErrorXfer = 1
85 msgInfo = 2
86 msgError = 3
87 msgWarning = 4
88 msgIOError = 22
89 msgNoop = 42
90 msgErrorExit = 86
91 msgSuccess = 100
92 msgDeleted = 101
93 msgNoSend = 102
94)
95
96// Special file-list index values.
97const (
98 ndxDone = -1
99 ndxFlistEOF = -2
100 ndxDelStats = -3
101)
102
103// I/O error bits reported at the end of the file list.
104const (
105 ioErrGeneral = 1 << 0
106 ioErrVanished = 1 << 1
107 ioErrDelLimit = 1 << 2
108 ioErrMask = ioErrGeneral | ioErrVanished | ioErrDelLimit
109)
110
111// Compat flags a protocol 30+ server sends. We never offer incremental
112// recursion, symlink times or iconv.
113const (
114 cfSafeFlist = 1 << 3
115 cfAvoidXattrOptim = 1 << 4
116 cfChksumSeedFix = 1 << 5
117 cfInplacePartialDir = 1 << 6
118 cfVarintFlistFlags = 1 << 7
119 cfID0Names = 1 << 8
120)
121
122// Exit codes (errcode.h).
123const (
124 exitSyntax = 1
125 exitProtocol = 2
126 exitFileSelect = 3
127 exitUnsupported = 4
128 exitFileIO = 11
129 exitStreamIO = 12
130 exitPartial = 23
131 exitVanished = 24
132 exitDelLimit = 25
133)