Sample
github.com/google/gopacket v1.1.19: Default
Verified sample for golang github.com/google/gopacket v1.1.19: Default. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:017e6c73a6f9ede8ab522a3e8e065bc682ab206d16fd9a184f9ecf2a78ff520d
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-04 |
Case
HOW- Goal
- verify github.com/google/gopacket.Default in pkg:golang/github.com/google/gopacket@v1.1.19
- Packages
- Symbols
-
- github.com/google/gopacket.Default
- Created
- 2026-09-04T03:02:39Z
Contract
- gopacket.Default is DecodeOptions with Lazy false and NoCopy false
- gopacket.Default provides eager layer decoding on NewPacket initialization
- gopacket.Default copies input buffer preserving packet data against underlying buffer mutations
- gopacket.Default is distinct from gopacket.Lazy and gopacket.NoCopy decode option presets
Files
- PROMPT.md
- csx.json
- default.go
- go.mod
- go.sum
- spec.json
- test/contract.go
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/google/gopacket.Default in pkg:golang/github.com/google/gopacket@v1.1.19
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/google/gopacket@v1.1.19
Demonstrate these symbols/APIs:
- github.com/google/gopacket.Default
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:b184015f45b513d4a885f5c24d37def0ccffdb33e74477e36ed128808dc73b40","contract":["gopacket.Default is DecodeOptions with Lazy false and NoCopy false","gopacket.Default provides eager layer decoding on NewPacket initialization","gopacket.Default copies input buffer preserving packet data against underlying buffer mutations","gopacket.Default is distinct from gopacket.Lazy and gopacket.NoCopy decode option presets"],"goal":"verify github.com/google/gopacket.Default in pkg:golang/github.com/google/gopacket@v1.1.19","kind":"HOW","packages":["pkg:golang/github.com/google/gopacket@v1.1.19"],"schemaVersion":1,"symbols":["github.com/google/gopacket.Default"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/google/gopacket@v1.1.19"],"schemaVersion":1,"subject":"pkg:golang/github.com/google/gopacket@v1.1.19","symbols":["github.com/google/gopacket.Default"],"verifierAdapter":"golang@1"}
package sample
import (
"github.com/google/gopacket"
)
// DefaultDecodeOptions returns the default decoding options provided by gopacket.
func DefaultDecodeOptions() gopacket.DecodeOptions {
return gopacket.Default
}
// DecodePacketWithDefault decodes raw packet data using gopacket.Default decode options.
func DecodePacketWithDefault(data []byte, firstLayer gopacket.Decoder) gopacket.Packet {
return gopacket.NewPacket(data, firstLayer, gopacket.Default)
}
// IsDefaultOptions checks if the provided options match gopacket.Default settings.
func IsDefaultOptions(opts gopacket.DecodeOptions) bool {
return opts == gopacket.Default
}
module sample
go 1.22.0
require github.com/google/gopacket v1.1.19
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
{
"schemaVersion": 1,
"goal": "verify github.com/google/gopacket.Default in pkg:golang/github.com/google/gopacket@v1.1.19",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/google/gopacket@v1.1.19"
],
"symbols": [
"github.com/google/gopacket.Default"
]
}
package main
import (
"bytes"
"fmt"
"net"
"os"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"sample"
)
func main() {
// Assertion 1: gopacket.Default is DecodeOptions with Lazy false and NoCopy false
opts := sample.DefaultDecodeOptions()
if opts.Lazy {
fmt.Fprintf(os.Stderr, "FAIL: expected gopacket.Default.Lazy to be false, got true\n")
os.Exit(1)
}
if opts.NoCopy {
fmt.Fprintf(os.Stderr, "FAIL: expected gopacket.Default.NoCopy to be false, got true\n")
os.Exit(1)
}
if opts.SkipDecodeRecovery {
fmt.Fprintf(os.Stderr, "FAIL: expected gopacket.Default.SkipDecodeRecovery to be false, got true\n")
os.Exit(1)
}
if opts.DecodeStreamsAsDatagrams {
fmt.Fprintf(os.Stderr, "FAIL: expected gopacket.Default.DecodeStreamsAsDatagrams to be false, got true\n")
os.Exit(1)
}
if !sample.IsDefaultOptions(gopacket.DecodeOptions{}) {
fmt.Fprintf(os.Stderr, "FAIL: expected zero-value DecodeOptions to equal gopacket.Default\n")
os.Exit(1)
}
// Prepare synthetic packet data: Ethernet -> IPv4 -> TCP -> Payload
srcMAC := net.HardwareAddr{0x00, 0x11, 0x22, 0x33, 0x44, 0x55}
dstMAC := net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}
srcIP := net.IP{192, 168, 1, 10}
dstIP := net.IP{192, 168, 1, 20}
srcPort := layers.TCPPort(8080)
dstPort := layers.TCPPort(80)
payloadBytes := []byte("contract-payload-test")
eth := &layers.Ethernet{
SrcMAC: srcMAC,
DstMAC: dstMAC,
EthernetType: layers.EthernetTypeIPv4,
}
ip := &layers.IPv4{
Version: 4,
IHL: 5,
TTL: 64,
Protocol: layers.IPProtocolTCP,
SrcIP: srcIP,
DstIP: dstIP,
}
tcp := &layers.TCP{
SrcPort: srcPort,
DstPort: dstPort,
SYN: true,
Seq: 1000,
}
if err := tcp.SetNetworkLayerForChecksum(ip); err != nil {
fmt.Fprintf(os.Stderr, "FAIL: failed to set network layer checksum: %v\n", err)
os.Exit(1)
}
buf := gopacket.NewSerializeBuffer()
serOpts := gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true}
if err := gopacket.SerializeLayers(buf, serOpts, eth, ip, tcp, gopacket.Payload(payloadBytes)); err != nil {
fmt.Fprintf(os.Stderr, "FAIL: SerializeLayers failed: %v\n", err)
os.Exit(1)
}
rawBytes := buf.Bytes()
copiedRaw := make([]byte, len(rawBytes))
copy(copiedRaw, rawBytes)
// Assertion 2: gopacket.Default provides eager layer decoding on NewPacket initialization
packet := sample.DecodePacketWithDefault(copiedRaw, layers.LayerTypeEthernet)
if packet.ErrorLayer() != nil {
fmt.Fprintf(os.Stderr, "FAIL: unexpected decode error: %v\n", packet.ErrorLayer().Error())
os.Exit(1)
}
decodedLayers := packet.Layers()
if len(decodedLayers) < 4 {
fmt.Fprintf(os.Stderr, "FAIL: expected at least 4 eagerly decoded layers, got %d\n", len(decodedLayers))
os.Exit(1)
}
ethDecoded, ok := packet.Layer(layers.LayerTypeEthernet).(*layers.Ethernet)
if !ok || ethDecoded == nil {
fmt.Fprintf(os.Stderr, "FAIL: expected Ethernet layer to be decoded\n")
os.Exit(1)
}
if !bytes.Equal(ethDecoded.SrcMAC, srcMAC) || !bytes.Equal(ethDecoded.DstMAC, dstMAC) {
fmt.Fprintf(os.Stderr, "FAIL: Ethernet MAC address mismatch\n")
os.Exit(1)
}
ipDecoded, ok := packet.Layer(layers.LayerTypeIPv4).(*layers.IPv4)
if !ok || ipDecoded == nil {
fmt.Fprintf(os.Stderr, "FAIL: expected IPv4 layer to be decoded\n")
os.Exit(1)
}
if !ipDecoded.SrcIP.Equal(srcIP) || !ipDecoded.DstIP.Equal(dstIP) {
fmt.Fprintf(os.Stderr, "FAIL: IPv4 IP address mismatch\n")
os.Exit(1)
}
tcpDecoded, ok := packet.Layer(layers.LayerTypeTCP).(*layers.TCP)
if !ok || tcpDecoded == nil {
fmt.Fprintf(os.Stderr, "FAIL: expected TCP layer to be decoded\n")
os.Exit(1)
}
if tcpDecoded.SrcPort != srcPort || tcpDecoded.DstPort != dstPort || !tcpDecoded.SYN {
fmt.Fprintf(os.Stderr, "FAIL: TCP header mismatch\n")
os.Exit(1)
}
appLayer := packet.ApplicationLayer()
if appLayer == nil || !bytes.Equal(appLayer.Payload(), payloadBytes) {
fmt.Fprintf(os.Stderr, "FAIL: application payload mismatch\n")
os.Exit(1)
}
// Assertion 3: gopacket.Default copies input buffer preserving packet data against underlying buffer mutations
savedPacketData := make([]byte, len(packet.Data()))
copy(savedPacketData, packet.Data())
// Mutate the original underlying buffer passed to NewPacket
for i := range copiedRaw {
copiedRaw[i] = 0xFF
}
// Packet data must remain unchanged because gopacket.Default.NoCopy is false
if !bytes.Equal(packet.Data(), savedPacketData) {
fmt.Fprintf(os.Stderr, "FAIL: packet.Data() was modified by external slice mutation (NoCopy was unexpectedly enabled)\n")
os.Exit(1)
}
if bytes.Equal(packet.Data(), copiedRaw) {
fmt.Fprintf(os.Stderr, "FAIL: packet.Data() mirrors mutated slice\n")
os.Exit(1)
}
// Assertion 4: gopacket.Default is distinct from gopacket.Lazy and gopacket.NoCopy decode option presets
if sample.IsDefaultOptions(gopacket.Lazy) {
fmt.Fprintf(os.Stderr, "FAIL: gopacket.Default must not equal gopacket.Lazy\n")
os.Exit(1)
}
if sample.IsDefaultOptions(gopacket.NoCopy) {
fmt.Fprintf(os.Stderr, "FAIL: gopacket.Default must not equal gopacket.NoCopy\n")
os.Exit(1)
}
if gopacket.Default.Lazy == gopacket.Lazy.Lazy {
fmt.Fprintf(os.Stderr, "FAIL: gopacket.Default.Lazy equals gopacket.Lazy.Lazy\n")
os.Exit(1)
}
if gopacket.Default.NoCopy == gopacket.NoCopy.NoCopy {
fmt.Fprintf(os.Stderr, "FAIL: gopacket.Default.NoCopy equals gopacket.NoCopy.NoCopy\n")
os.Exit(1)
}
fmt.Println("PASS: gopacket.Default contract verified successfully")
}
Origin Seeder
anonymous