protocol #
Protocols Database Access
The protocol module provides thread-safe access to the operatins system protocols database.
See protocols(5) and getprotoent(3) for details.
fn protocol_by_name #
fn protocol_by_name(name string) !ProtocolEntry
protocol_by_name returns the protocol entry by name e.g. 'tcp', 'icmp'.
fn protocol_by_number #
fn protocol_by_number(num int) !ProtocolEntry
protocol_by_number returns the protocol entry by protocol number.
fn protocols #
fn protocols() []ProtocolEntry
protocols returns all protocol entries from database in arbitrary order.
struct ProtocolEntry #
struct ProtocolEntry {
pub:
name string // The official name of protocol.
aliases []string // List of alternative names for the protocol.
number int // The protocol number.
}