Skip to content

Commit 80103bc

Browse files
committed
edit README
1 parent 6d4a87b commit 80103bc

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ at the beginning of every internet datagram (more fondly known as a "packet").
5959
```
6060

6161
```
62+
TCP Header Format
63+
64+
6265
0 1 2 3
6366
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
6467
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -78,11 +81,74 @@ at the beginning of every internet datagram (more fondly known as a "packet").
7881
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
7982
| data |
8083
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
84+
8185
TCP Header Format
86+
8287
Note that one tick mark represents one bit position.
88+
8389
Figure 3.
8490
```
8591

92+
### File Formats
93+
Binary file formats are not significantly different from message formats
94+
from an application developer's perspective.
95+
[RFC 1952](https://datatracker.ietf.org/doc/html/rfc1952)
96+
describing the GZIP File Format Specification
97+
offers a gentle introduction to the topic.
98+
99+
```
100+
1.2. Intended audience
101+
102+
...
103+
104+
The text of the specification assumes a basic background in
105+
programming at the level of bits and other primitive data
106+
representations.
107+
108+
2.1. Overall conventions
109+
110+
In the diagrams below, a box like this:
111+
112+
+---+
113+
| | <-- the vertical bars might be missing
114+
+---+
115+
116+
represents one byte; ...
117+
118+
2.2. File format
119+
120+
A gzip file consists of a series of "members" (compressed data
121+
sets). The format of each member is specified in the following
122+
section. The members simply appear one after another in the file,
123+
with no additional information before, between, or after them.
124+
125+
2.3. Member format
126+
127+
Each member has the following structure:
128+
129+
+---+---+---+---+---+---+---+---+---+---+
130+
|ID1|ID2|CM |FLG| MTIME |XFL|OS | (more-->)
131+
+---+---+---+---+---+---+---+---+---+---+
132+
133+
...
134+
135+
2.3.1. Member header and trailer
136+
137+
...
138+
139+
FLG (FLaGs)
140+
This flag byte is divided into individual bits as follows:
141+
142+
bit 0 FTEXT
143+
bit 1 FHCRC
144+
bit 2 FEXTRA
145+
bit 3 FNAME
146+
bit 4 FCOMMENT
147+
bit 5 reserved
148+
bit 6 reserved
149+
bit 7 reserved
150+
```
151+
86152
## Working with Binary Formats in Go
87153
Message and file formats specify how bits are arranged to encode information.
88154
Control over individual bits or groups smaller than a byte is often required

0 commit comments

Comments
 (0)