Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadFromFile ¶
LoadFromFile parses the given CSV file and overrides the embedded data. You don't need to call this for normal use.
func LoadFromReader ¶
LoadFromReader parses protocol data from any io.Reader and overrides the embedded data. You don't need to call this for normal use.
func LookupDecimal ¶
LookupDecimal returns the Decimal value for a given name.
"name" can be either:
- the Keyword (short name, e.g. "TCP")
- the Protocol (long name, e.g. "Transmission Control")
For ranges like "148-252", this returns DecimalStart.
func LookupKeyword ¶
LookupKeyword returns the short name (Keyword) for a protocol number, e.g. 6 -> "TCP".
func LookupProtocolName ¶
LookupProtocolName returns the long "Protocol" field for a protocol number, e.g. 6 -> "Transmission Control".
Types ¶
type Entry ¶
type Entry struct {
DecimalStart int // first number in the range
DecimalEnd int // last number in the range (== DecimalStart for non-range)
Keyword string // "Keyword" column, short name, e.g. "TCP"
Protocol string // "Protocol" column, long name, e.g. "Transmission Control"
IPv6ExtHdr string // "IPv6 Extension Header" column (usually "Y" or empty)
Reference string // "Reference" column, raw text
}
Entry represents one row (or range) from the IANA protocol numbers CSV.
The "Decimal" column can be either a single number (e.g. "6") or a range (e.g. "148-252"). For ranges, DecimalStart/DecimalEnd represent the inclusive range.
func LookupByNumber ¶
LookupByNumber returns the Entry for a given protocol number (0–255).
If not found, ok will be false.