feat(pcap): complete replay system with filtering, metadata, and live replay

Wire ExcludeOpcodes config into RecordingConn so configured opcodes
(e.g. ping, nop, position) are filtered at record time. Add padded
metadata with in-place PatchMetadata to populate CharID/UserID after
login. Implement --mode replay using protbot's encrypted connection
with timing-aware packet sending, auto-ping response, concurrent
S→C collection, and byte-level payload diff reporting.
This commit is contained in:
Houmgaor
2026-02-23 19:34:30 +01:00
parent 7ef5efc549
commit f712e3c04d
14 changed files with 679 additions and 42 deletions

View File

@@ -74,14 +74,15 @@ type Session struct {
Name string
closed atomic.Bool
ackStart map[uint32]time.Time
captureCleanup func() // Called on session close to flush/close capture file
captureConn *pcap.RecordingConn // non-nil when capture is active
captureCleanup func() // Called on session close to flush/close capture file
}
// NewSession creates a new Session type.
func NewSession(server *Server, conn net.Conn) *Session {
var cryptConn network.Conn = network.NewCryptConn(conn, server.erupeConfig.RealClientMode, server.logger.Named(conn.RemoteAddr().String()))
cryptConn, captureCleanup := startCapture(server, cryptConn, conn.RemoteAddr(), pcap.ServerTypeChannel)
cryptConn, captureConn, captureCleanup := startCapture(server, cryptConn, conn.RemoteAddr(), pcap.ServerTypeChannel)
s := &Session{
logger: server.logger.Named(conn.RemoteAddr().String()),
@@ -96,6 +97,7 @@ func NewSession(server *Server, conn net.Conn) *Session {
stageMoveStack: stringstack.New(),
ackStart: make(map[uint32]time.Time),
semaphoreID: make([]uint16, 2),
captureConn: captureConn,
captureCleanup: captureCleanup,
}
return s