serial

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package serial implements RFC 1982 serial number arithmetic for DNS zone serials. See: https://datatracker.ietf.org/doc/html/rfc1982

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Serial

type Serial uint32

Serial is a 32-bit serial number with RFC 1982 comparison semantics.

func FromUint32

func FromUint32(v uint32) Serial

FromUint32 converts a uint32 to Serial.

func (Serial) Add

func (s Serial) Add(other Serial) Serial

Add returns s + other with uint32 wraparound.

func (Serial) Equal

func (s Serial) Equal(other Serial) bool

Equal returns true if s equals other.

func (Serial) GreaterThan

func (s Serial) GreaterThan(other Serial) bool

GreaterThan returns true if s is strictly greater than other.

func (Serial) Increment

func (s Serial) Increment() Serial

Increment returns s + 1 with uint32 wraparound.

func (Serial) LessThan

func (s Serial) LessThan(other Serial) bool

LessThan returns true if s is strictly less than other in serial arithmetic. Relies on uint32 wrapping (modulo 2^32). Note: If distance is exactly 2^31, the comparison is undefined per RFC 1982; this implementation returns false in that case.

func (Serial) Next

func (s Serial) Next() Serial

Next calculates the next serial number. Uses Unix timestamp if it's greater than current (per RFC 1982 semantics), otherwise increments by 1.

func (Serial) Subtract

func (s Serial) Subtract(other Serial) Serial

Subtract returns s - other with uint32 wraparound.

Jump to

Keyboard shortcuts

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