common

package
v0.0.0-...-c04e0fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package common provides common functions for Geneva.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateIPv4Checksum

func CalculateIPv4Checksum(bytes []byte) uint16

CalculateIPv4Checksum calculates the IPv4 checksum for the given bytes. copied from gopacket/layers/ip4.go because they didn't export one. for whatever some reason..

func UpdateIPv4Checksum

func UpdateIPv4Checksum(ip *layers.IPv4)

UpdateIPv4Checksum updates the IPv4 checksum field and the raw bytes for a gopacket IPv4 layer.

func UpdateTCPChecksum

func UpdateTCPChecksum(tcp *layers.TCP, ip *layers.IPv4)

UpdateTCPChecksum updates the TCP checksum field and the raw bytes for a gopacket TCP layer.

The TCP checksum covers a pseudo-header derived from the IPv4 source and destination addresses, so ip must be the TCP layer's network layer. A freshly decoded packet does not carry that association, which is why the caller passes it explicitly; without it ComputeChecksum fails and the checksum would be left zero. ip may be nil only when the TCP layer already has its network layer set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL