@@ -27,22 +27,24 @@ type IGMPMessage interface {
2727}
2828
2929// IGMPv1:
30- // 0 1 2 3
31- // 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
32- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33- // |Version| Type | Unused | Checksum |
34- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35- // | Group Address |
36- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30+ //
31+ // 0 1 2 3
32+ // 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
33+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34+ // |Version| Type | Unused | Checksum |
35+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36+ // | Group Address |
37+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3738//
3839// IGMPv2:
39- // 0 1 2 3
40- // 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
41- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42- // | Type | Max Resp Time | Checksum |
43- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44- // | Group Address |
45- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40+ //
41+ // 0 1 2 3
42+ // 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
43+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44+ // | Type | Max Resp Time | Checksum |
45+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46+ // | Group Address |
47+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4648type IGMPv1or2 struct {
4749 Type uint8
4850 MaxResponseTime uint8 // It is 0 for IGMPv1 message.
@@ -113,24 +115,25 @@ func NewIGMPv2Leave(group net.IP) *IGMPv1or2 {
113115}
114116
115117// IGMPv3Query:
116- // 0 1 2 3
117- // 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
118- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
119- // | Type = 0x11 | Max Resp Code | Checksum |
120- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
121- // | Group Address |
122- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
123- // | Resv |S| QRV | QQIC | Number of Sources (N) |
124- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
125- // | Source Address [1] |
126- // +- -+
127- // | Source Address [2] |
128- // +- . -+
129- // . . .
130- // . . .
131- // +- -+
132- // | Source Address [N] |
133- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
118+ //
119+ // 0 1 2 3
120+ // 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
121+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
122+ // | Type = 0x11 | Max Resp Code | Checksum |
123+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
124+ // | Group Address |
125+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
126+ // | Resv |S| QRV | QQIC | Number of Sources (N) |
127+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
128+ // | Source Address [1] |
129+ // +- -+
130+ // | Source Address [2] |
131+ // +- . -+
132+ // . . .
133+ // . . .
134+ // +- -+
135+ // | Source Address [N] |
136+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
134137type IGMPv3Query struct {
135138 Type uint8
136139 MaxResponseTime uint8
@@ -222,29 +225,30 @@ func NewIGMPv3Query(group net.IP, maxResponseTime uint8, queryInterval uint8, so
222225}
223226
224227// IGMPv3GroupRecord:
225- // 0 1 2 3
226- // 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
227- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
228- // | Record Type | Aux Data Len | Number of Sources (N) |
229- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
230- // | Multicast Address |
231- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
232- // | Source Address [1] |
233- // +- -+
234- // | Source Address [2] |
235- // +- -+
236- // . . .
237- // . . .
238- // . . .
239- // +- -+
240- // | Source Address [N] |
241- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
242- // | |
243- // . .
244- // . Auxiliary Data .
245- // . .
246- // | |
247- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
228+ //
229+ // 0 1 2 3
230+ // 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
231+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
232+ // | Record Type | Aux Data Len | Number of Sources (N) |
233+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
234+ // | Multicast Address |
235+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
236+ // | Source Address [1] |
237+ // +- -+
238+ // | Source Address [2] |
239+ // +- -+
240+ // . . .
241+ // . . .
242+ // . . .
243+ // +- -+
244+ // | Source Address [N] |
245+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
246+ // | |
247+ // . .
248+ // . Auxiliary Data .
249+ // . .
250+ // | |
251+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
248252type IGMPv3GroupRecord struct {
249253 Type uint8
250254 AuxDataLen uint8 // this should always be 0 as per IGMPv3 spec.
@@ -317,35 +321,36 @@ func NewGroupRecord(recordType uint8, group net.IP, sources []net.IP) IGMPv3Grou
317321}
318322
319323// IGMPv3MembershipReport:
320- // 0 1 2 3
321- // 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
322- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
323- // | Type = 0x22 | Reserved | Checksum |
324- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
325- // | Reserved | Number of Group Records (M) |
326- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
327- // | |
328- // . .
329- // . Group Record [1] .
330- // . .
331- // | |
332- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
333- // | |
334- // . .
335- // . Group Record [2] .
336- // . .
337- // | |
338- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
339- // | . |
340- // . . .
341- // | . |
342- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
343- // | |
344- // . .
345- // . Group Record [M] .
346- // . .
347- // | |
348- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
324+ //
325+ // 0 1 2 3
326+ // 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
327+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
328+ // | Type = 0x22 | Reserved | Checksum |
329+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
330+ // | Reserved | Number of Group Records (M) |
331+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
332+ // | |
333+ // . .
334+ // . Group Record [1] .
335+ // . .
336+ // | |
337+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
338+ // | |
339+ // . .
340+ // . Group Record [2] .
341+ // . .
342+ // | |
343+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
344+ // | . |
345+ // . . .
346+ // | . |
347+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
348+ // | |
349+ // . .
350+ // . Group Record [M] .
351+ // . .
352+ // | |
353+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
349354type IGMPv3MembershipReport struct {
350355 Type uint8
351356 Reserved uint8
0 commit comments