mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
feat(network): add protocol packet capture and replay system
Add a recording and replay foundation for the MHF network protocol. A RecordingConn decorator wraps network.Conn to transparently capture all decrypted packets to binary .mhfr files, with zero handler changes and zero overhead when disabled. - network/pcap: binary capture format (writer, reader, filters) - RecordingConn: thread-safe Conn decorator with direction tracking - CaptureOptions in config (disabled by default) - Capture wired into all three server types (sign, entrance, channel) - cmd/replay: CLI tool with dump, json, stats, and compare modes - 19 new tests, all passing with -race
This commit is contained in:
@@ -85,6 +85,7 @@ type Config struct {
|
||||
EarthMonsters []int32
|
||||
SaveDumps SaveDumpOptions
|
||||
Screenshots ScreenshotsOptions
|
||||
Capture CaptureOptions
|
||||
|
||||
DebugOptions DebugOptions
|
||||
GameplayOptions GameplayOptions
|
||||
@@ -112,6 +113,16 @@ type ScreenshotsOptions struct {
|
||||
UploadQuality int //Determines the upload quality to the server
|
||||
}
|
||||
|
||||
// CaptureOptions controls protocol packet capture recording.
|
||||
type CaptureOptions struct {
|
||||
Enabled bool // Enable packet capture
|
||||
OutputDir string // Directory for .mhfr capture files
|
||||
ExcludeOpcodes []uint16 // Opcodes to exclude from capture (e.g., ping, nop, position)
|
||||
CaptureSign bool // Capture sign server sessions
|
||||
CaptureEntrance bool // Capture entrance server sessions
|
||||
CaptureChannel bool // Capture channel server sessions
|
||||
}
|
||||
|
||||
// DebugOptions holds various debug/temporary options for use while developing Erupe.
|
||||
type DebugOptions struct {
|
||||
CleanDB bool // Automatically wipes the DB on server reset.
|
||||
@@ -328,6 +339,12 @@ func LoadConfig() (*Config, error) {
|
||||
Enabled: true,
|
||||
OutputDir: "save-backups",
|
||||
})
|
||||
viper.SetDefault("Capture", CaptureOptions{
|
||||
OutputDir: "captures",
|
||||
CaptureSign: true,
|
||||
CaptureEntrance: true,
|
||||
CaptureChannel: true,
|
||||
})
|
||||
viper.SetDefault("LoopDelay", 50)
|
||||
|
||||
err := viper.ReadInConfig()
|
||||
|
||||
Reference in New Issue
Block a user