mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
16 lines
325 B
Swift
16 lines
325 B
Swift
//
|
|
// IPv4PacketRewriter.swift
|
|
// StikDebug
|
|
//
|
|
|
|
enum IPv4PacketRewriter {
|
|
static func swapEndpoints(in packet: inout [UInt8]) {
|
|
guard packet.count >= 20, packet[0] >> 4 == 4 else {
|
|
return
|
|
}
|
|
|
|
for offset in 0..<4 {
|
|
packet.swapAt(12 + offset, 16 + offset)
|
|
}
|
|
}
|
|
}
|