2024-06-25 04:19:51 +00:00
|
|
|
package snapshot7_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/internal/testutils/require"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/protocol7"
|
|
|
|
)
|
|
|
|
|
|
|
|
// --------------------------------
|
|
|
|
// snap single
|
|
|
|
// --------------------------------
|
|
|
|
|
|
|
|
func TestDDNetFullServerSnapSingle(t *testing.T) {
|
|
|
|
// vanilla client connected to almost full ddnet rus server
|
|
|
|
// dumped with tcpdump
|
|
|
|
// libtw2 dissector details
|
|
|
|
// this is the n-th snapshot that is a snap single the prior snapshots were partials snaps
|
|
|
|
//
|
|
|
|
// User Datagram Protocol, Src Port: 8316, Dst Port: 51479
|
|
|
|
// Teeworlds 0.7 Protocol packet
|
|
|
|
// Teeworlds 0.7 Protocol chunk: sys.snap_single
|
|
|
|
// Header (non-vital)
|
|
|
|
// Message: sys.snap_single
|
|
|
|
// Tick: 11271652
|
|
|
|
// Delta tick: 22
|
|
|
|
// Crc: 1032529567
|
|
|
|
// Data (114 bytes)
|
|
|
|
dump := []byte{
|
|
|
|
0x10, 0x04, 0x01, 0x1f, 0x5a, 0x5e, 0xd8,
|
|
|
|
0x28, 0x15, 0xa6, 0x6c, 0xfb, 0x4a, 0xd3, 0xd6, 0xd3, 0xe0, 0x54, 0x85, 0x09, 0x72, 0xc4,
|
|
|
|
0x0d, 0x2e, 0xb6, 0xe9, 0x2f, 0xbc, 0xfd, 0xb9, 0x5d, 0xd0, 0x35, 0x5d, 0x5e, 0xcf, 0xb5, 0x35,
|
|
|
|
0xeb, 0x92, 0xe8, 0xbe, 0xbb, 0x9f, 0xd1, 0x7f, 0x17, 0x24, 0x2d, 0xb8, 0xfa, 0x7f, 0x5f, 0xf5,
|
|
|
|
0x38, 0x7b, 0x7a, 0xc1, 0x47, 0x73, 0xeb, 0x4a, 0xd0, 0x62, 0x02, 0x17, 0x6d, 0xd9, 0xe2, 0x58,
|
|
|
|
0x57, 0x68, 0xc9, 0xe6, 0x35, 0xf9, 0x0a, 0xd3, 0xd6, 0x7b, 0xf6, 0x5d, 0x90, 0xb4, 0x10, 0xfa,
|
|
|
|
0x9a, 0x7c, 0x85, 0x69, 0xeb, 0xbf, 0xe1, 0x2b, 0x4d, 0x5b, 0xef, 0x1e, 0x4f, 0xea, 0x85, 0xe2,
|
|
|
|
0x06,
|
|
|
|
}
|
|
|
|
|
|
|
|
conn := protocol7.Session{}
|
|
|
|
|
|
|
|
packet := protocol7.Packet{}
|
|
|
|
err := packet.Unpack(dump)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
conn.Ack = packet.Header.Ack
|
|
|
|
repack := packet.Pack(&conn)
|
|
|
|
require.Equal(t, dump, repack)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSvEmoticonAndSnapSingle(t *testing.T) {
|
|
|
|
// Teeworlds 0.7 Protocol packet
|
|
|
|
// Teeworlds 0.7 Protocol chunk: game.sv_emoticon
|
|
|
|
// Header (vital: 234)
|
|
|
|
// Message: game.sv_emoticon
|
|
|
|
// Client id: 39
|
|
|
|
// Emoticon: exclamation
|
|
|
|
// Teeworlds 0.7 Protocol chunk: sys.snap_single
|
|
|
|
// Header (non-vital)
|
|
|
|
// Message: sys.snap_single
|
|
|
|
// Tick: 11271828
|
|
|
|
// Delta tick: 24
|
|
|
|
// Crc: 1021386082
|
|
|
|
// Data (190 bytes)
|
|
|
|
dump := []byte{
|
|
|
|
0x10, 0x05, 0x02, 0x1f, 0x5a, 0x5e,
|
|
|
|
0xd8, 0x4a, 0x16, 0xd4, 0x0d, 0x2f, 0x0b, 0x2d, 0xfc, 0x4d, 0x19, 0xae, 0xd4, 0xb4, 0xf5, 0x10,
|
|
|
|
0x9f, 0xa1, 0x48, 0x8b, 0x2b, 0xbb, 0xd1, 0x15, 0x48, 0x5a, 0xce, 0x52, 0xed, 0xef, 0x97, 0x58,
|
|
|
|
0xef, 0xa2, 0x29, 0x6d, 0x82, 0xb7, 0x6b, 0xb6, 0x91, 0x1a, 0x1b, 0x4e, 0x72, 0xbb, 0x1d, 0x7d,
|
|
|
|
0xcf, 0x71, 0x04, 0x55, 0x09, 0x5f, 0x21, 0xfe, 0x2e, 0x48, 0x5a, 0xb8, 0xa8, 0xff, 0x87, 0x42,
|
|
|
|
0x26, 0x55, 0xa2, 0x9e, 0xeb, 0x22, 0x2d, 0x37, 0xc6, 0xb0, 0xa4, 0x33, 0x9e, 0x96, 0x1b, 0x0b,
|
|
|
|
0xfc, 0xab, 0xaa, 0x87, 0x37, 0x5c, 0xa9, 0x69, 0xeb, 0x19, 0x92, 0xe8, 0x3b, 0x56, 0x3e, 0x0b,
|
|
|
|
0x5b, 0x80, 0x73, 0xea, 0xb4, 0x50, 0xaa, 0x54, 0x6f, 0x49, 0xa2, 0x0b, 0xac, 0x38, 0x15, 0x3c,
|
|
|
|
0x66, 0x71, 0xc4, 0x5d, 0x90, 0xb4, 0x80, 0xd7, 0x03, 0x60, 0x53, 0x14, 0xa7, 0x5e, 0xf8, 0x90,
|
|
|
|
0xa7, 0x17, 0x3c, 0xa1, 0x17, 0xbe, 0x2e, 0x54, 0xa0, 0xde, 0x0f, 0xe4, 0x2d, 0xe8, 0xcc, 0x44,
|
|
|
|
0xc2, 0x2f, 0x85, 0x36, 0x7f, 0x17, 0x24, 0x2d, 0x84, 0xfe, 0x9f, 0x25, 0x52, 0xaf, 0x57, 0xdc,
|
|
|
|
0x00,
|
|
|
|
}
|
|
|
|
|
|
|
|
conn := protocol7.Session{}
|
|
|
|
|
|
|
|
packet := protocol7.Packet{}
|
|
|
|
err := packet.Unpack(dump)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
conn.Ack = packet.Header.Ack
|
|
|
|
repack := packet.Pack(&conn)
|
|
|
|
|
|
|
|
fmt.Printf("repack: %x\n", repack)
|
|
|
|
fmt.Printf("dump: %x\n", dump)
|
|
|
|
|
|
|
|
require.Equal(t, dump, repack)
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------
|
|
|
|
// multi part snaps
|
|
|
|
// --------------------------------
|
|
|
|
|
2024-06-25 04:22:05 +00:00
|
|
|
// func TestVoteOptionListAddPlusTwoSnaps(t *testing.T) {
|
|
|
|
// // vanilla client connected to almost full ddnet rus server
|
|
|
|
// // dumped with tcpdump
|
|
|
|
// //
|
|
|
|
// // these are two consecutive packets
|
|
|
|
// // - packet1: vote_list, snap (part 1/2)
|
|
|
|
// // - packet2: snap (part 2/2)
|
|
|
|
//
|
|
|
|
// // Teeworlds 0.7 Protocol packet
|
|
|
|
// // Teeworlds 0.7 Protocol chunk: game.sv_vote_option_list_add
|
|
|
|
// // Teeworlds 0.7 Protocol chunk: sys.snap
|
|
|
|
// // Header (non-vital)
|
|
|
|
// // Message: sys.snap
|
|
|
|
// // Tick: 11271610
|
|
|
|
// // Delta tick: 11271611
|
|
|
|
// // Num parts: 2
|
|
|
|
// // Part: 0
|
|
|
|
// // Crc: 986678629
|
|
|
|
// // Data (900 bytes)
|
|
|
|
// dumpVoteListAndPart1 := []byte{
|
|
|
|
// 0x10, 0x04, 0x02, 0x1f, 0x5a, 0x5e,
|
|
|
|
// 0xd8, 0x5a, 0xd9, 0x55, 0x86, 0xd8, 0xb5, 0xf6, 0x35, 0x1c, 0x0d, 0xe7, 0x8a, 0xc3, 0xda, 0x35,
|
|
|
|
// 0xab, 0xf0, 0x03, 0x6b, 0x5b, 0xc2, 0xda, 0x75, 0x8e, 0x86, 0x52, 0x5f, 0x7c, 0x0d, 0x6b, 0xd7,
|
|
|
|
// 0x6c, 0x62, 0x97, 0x87, 0x83, 0x13, 0x5c, 0x3b, 0x27, 0xc0, 0x99, 0x2d, 0xe5, 0x04, 0xd6, 0xb6,
|
|
|
|
// 0x18, 0xca, 0x59, 0x53, 0xe8, 0x5a, 0x39, 0x81, 0x8e, 0x5c, 0x8b, 0x6b, 0x63, 0x6d, 0x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xa9, 0x1f, 0x35, 0xa8, 0xde, 0x1f, 0x5a, 0xa5, 0x74,
|
|
|
|
// 0x25, 0x2d, 0xa0, 0x89, 0xf9, 0x40, 0x43, 0x9a, 0x92, 0x54, 0xaf, 0xf7, 0x57, 0x50, 0x29, 0x5d,
|
|
|
|
// 0x49, 0x0b, 0x05, 0x62, 0x3e, 0x0a, 0x90, 0x03, 0xc7, 0xbb, 0x06, 0xbd, 0xbf, 0xb9, 0x52, 0xba,
|
|
|
|
// 0x92, 0x16, 0x66, 0x31, 0x1f, 0x33, 0x6a, 0x72, 0x65, 0xd3, 0xd6, 0xfb, 0x2b, 0xd7, 0xc2, 0x5f,
|
|
|
|
// 0x2a, 0xd2, 0x95, 0xb4, 0x50, 0x16, 0xf3, 0x51, 0x46, 0xb8, 0xae, 0x6c, 0xda, 0x7a, 0x7f, 0x97,
|
|
|
|
// 0xda, 0x86, 0x9e, 0x47, 0xe9, 0x4a, 0x5a, 0xb8, 0x24, 0x30, 0x1f, 0x97, 0xd0, 0xc7, 0xd2, 0xf9,
|
|
|
|
// 0x5e, 0xef, 0xcf, 0xba, 0x52, 0xba, 0x92, 0x16, 0xac, 0xc5, 0x7c, 0x58, 0xa3, 0x14, 0x8e, 0xb8,
|
|
|
|
// 0x06, 0xbd, 0x3f, 0xa3, 0x4a, 0xe9, 0x4a, 0x5a, 0x30, 0x12, 0xd8, 0x5f, 0x77, 0x2d, 0xbe, 0xb6,
|
|
|
|
// 0x8f, 0x31, 0x5d, 0x49, 0x0b, 0xdd, 0x62, 0x3e, 0x8a, 0x1b,
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // User Datagram Protocol, Src Port: 8316, Dst Port: 51479
|
|
|
|
// // Teeworlds 0.7 Protocol packet
|
|
|
|
// // Teeworlds 0.7 Protocol chunk: sys.snap
|
|
|
|
// // Header (non-vital)
|
|
|
|
// // Message: sys.snap
|
|
|
|
// // Tick: 11271610
|
|
|
|
// // Delta tick: 11271611
|
|
|
|
// // Num parts: 2
|
|
|
|
// // Part: 1
|
|
|
|
// // Crc: 986678629
|
|
|
|
// // Data (556 bytes)
|
|
|
|
// dumpPart2 := []byte{
|
|
|
|
//
|
|
|
|
// 0x10, 0x04, 0x01, 0x1f, 0x5a, 0x5e,
|
|
|
|
// 0xd8, 0xc4, 0xb4, 0x38, 0x1c, 0x38, 0xc6, 0xb4, 0xf5, 0xee, 0xe5, 0x18, 0xd3, 0xd6, 0x0b, 0x64,
|
|
|
|
// 0xa0, 0x98, 0x69, 0x95, 0xe6, 0x26, 0x8d, 0xe8, 0x46, 0x97, 0x9b, 0x98, 0xea, 0xf5, 0xfe, 0xa6,
|
|
|
|
// 0x57, 0x4a, 0x57, 0xd2, 0xc2, 0x74, 0x31, 0x1f, 0xd3, 0x91, 0x1f, 0xc7, 0x98, 0xb6, 0xde, 0x1f,
|
|
|
|
// 0x46, 0xa5, 0x74, 0x25, 0x2d, 0x60, 0x88, 0xf9, 0xc0, 0x40, 0x96, 0xb4, 0xf8, 0x5e, 0xef, 0xaf,
|
|
|
|
// 0xa8, 0x52, 0xba, 0x92, 0x16, 0x8a, 0xc4, 0x7c, 0x14, 0xa1, 0x42, 0x5f, 0x9b, 0xea, 0xf5, 0xfe,
|
|
|
|
// 0xda, 0x4b, 0xa7, 0x7a, 0x57, 0xa4, 0x2b, 0x69, 0xa1, 0x5d, 0xcc, 0x47, 0x3b, 0xfa, 0x4e, 0xea,
|
|
|
|
// 0xa8, 0x5e, 0xef, 0x2f, 0xab, 0x52, 0xba, 0x92, 0x16, 0xb2, 0xc4, 0x7c, 0x64, 0xa1, 0x14, 0xbe,
|
|
|
|
// 0x31, 0x6d, 0xbd, 0xbf, 0x35, 0x54, 0x5f, 0x75, 0x2d, 0xe9, 0x4a, 0x5a, 0x58, 0xc5, 0x7c, 0xac,
|
|
|
|
// 0x68, 0xdb, 0x87, 0x4c, 0x5b, 0xef, 0xaf, 0xd3, 0xb6, 0x25, 0x28, 0x4f, 0x57, 0xd2, 0x42, 0x47,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7d, 0x86, 0xf8, 0x41, 0xaa, 0x4a, 0x19, 0xe8, 0x57, 0x4a, 0xef,
|
|
|
|
// 0x33, 0xc4, 0x0f, 0x52, 0x75, 0x01, 0xa9, 0xce, 0xe2, 0xed, 0xbb, 0x20, 0x69, 0x41, 0x07, 0x3d,
|
|
|
|
// 0x00, 0x36, 0x45, 0x68, 0xa7, 0x4a, 0xe4, 0x68, 0xc5, 0x0d,
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // packet 1
|
|
|
|
// {
|
|
|
|
// conn := protocol7.Session{}
|
|
|
|
//
|
|
|
|
// packet := protocol7.Packet{}
|
|
|
|
// err := packet.Unpack(dumpVoteListAndPart1)
|
|
|
|
// require.NoError(t, err)
|
|
|
|
//
|
|
|
|
// conn.Ack = packet.Header.Ack
|
|
|
|
// repack := packet.Pack(&conn)
|
|
|
|
//
|
|
|
|
// fmt.Printf(" want: %x\n", dumpVoteListAndPart1)
|
|
|
|
// fmt.Printf("repack: %x\n", repack)
|
|
|
|
//
|
|
|
|
// require.Equal(t, dumpVoteListAndPart1, repack)
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // packet 2
|
|
|
|
// {
|
|
|
|
// conn := protocol7.Session{}
|
|
|
|
//
|
|
|
|
// packet := protocol7.Packet{}
|
|
|
|
// err := packet.Unpack(dumpPart2)
|
|
|
|
// require.NoError(t, err)
|
|
|
|
//
|
|
|
|
// conn.Ack = packet.Header.Ack
|
|
|
|
// repack := packet.Pack(&conn)
|
|
|
|
// require.Equal(t, dumpPart2, repack)
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // TODO: combine the snap parts together into one full snap
|
|
|
|
// }
|