iana

package
v0.4.135 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: ISC Imports: 6 Imported by: 0

Documentation

Overview

AddressFamily contains iana Address Family Numbers such as IP versions 4 and 6 for the Internet.

InternetSocket is a unique named type for socket identifiers based on protocol, IP address and possibly port number.

Port contains an iana port number 1…65535.

Protocol represents iana Assigned Internet Protocol Numbers for IPv4 and IPv6.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressFamily

type AddressFamily uint16

AddressFamily contains iana Address Family Numbers such as IP versions 4 and 6 for the Internet.

  • AddressFamily is ordered
  • AddressFamily implements fmt.Stringer
  • AddressFamily has methods IsValid Description Int Uint16

IANA address-family-numbers

const (
	AFreserved0 AddressFamily = iota         // 0 Reserved
	AFip                                     // IP (IP version 4)
	AFip6                                    // IP6 (IP version 6)
	AFnsap                                   // NSAP NSAP
	AFhdlc                                   // HDLC HDLC (8-bit multidrop)
	AFbbn                                    // BBN BBN 1822
	AF802                                    // 802 (includes all 802 media plus Ethernet
	AFe163                                   // E.163 E.163
	AFe164                                   // E.164 E.164 (SMDS, Frame Relay, ATM)
	AFf69                                    // F.69 F.69 (Telex)
	AFx121                                   // X.121 X.121 (X.25, Frame Relay)
	AFips                                    // IPX IPX
	AFappletalk                              // Appletalk Appletalk
	AFdecnet                                 // DECNET Decnet IV
	AFbv                                     // BV Banyan Vines
	AFe164n                                  // E.164N E.164 with NSAP format subaddress
	AFdns                                    // DNS DNS (Domain Name System)
	AFdn                                     // DN Distinguished Name
	AFas                                     // AS AS Number
	AFxtpip                                  // XTPIP XTP over IP version 4
	AFxtpip6                                 // XTPIP6 XTP over IP version 6
	AFxtp                                    // XTP XTP native mode XTP
	AFwwp                                    // WWP Fibre Channel World-Wide Port Name
	AFwwn                                    // WWN Fibre Channel World-Wide Node Name
	AFgwid                                   // GWID GWID
	AFafi                                    // AFI AFI for L2VPN information	[RFC4761][RFC6074]
	AFmplss                                  // MPLSS MPLS-TP Section Endpoint Identifier	[RFC7212]
	AFmplse                                  // MPLSE MPLS-TP LSP Endpoint Identifier	[RFC7212]
	AFmplsp                                  // MPLSP MPLS-TP Pseudowire Endpoint Identifier	[RFC7212]
	AFmtip                                   // MTIP MT IP: Multi-Topology IP version 4	[RFC7307]
	AFmtip6                                  // MTIP6 MT IPv6: Multi-Topology IP version 6	[RFC7307]
	AFbgp                                    // BGP BGP SFC	[RFC9015]
	AFeigrp     AddressFamily = 16352 + iota // EIGRP EIGRP Common Service Family
	AFeigrp4                                 // EIGRP4 EIGRP IPv4 Service Family
	AFeigrp6                                 // EIGRP6 EIGRP IPv6 Service Family
	AFlisp                                   // LISP LISP Canonical Address Format (LCAF)
	AFbgpls                                  // BGP-LS BGP-LS	[RFC7752]
	AFmac48                                  // MAC48 48-bit MAC	[RFC7042]	2013-05-06
	AFmac64                                  // MAC64 64-bit MAC	[RFC7042]	2013-05-06
	AFoui                                    // OUI OUI	[RFC7961]
	AFmac24                                  // MAC/24 MAC/24	[RFC7961]
	AFmac40                                  // MAC/40 MAC/40	[RFC7961]
	AFipv664                                 // IPv6/64 IPv6/64	[RFC7961]
	AFrb                                     // RBridge RBridge Port ID	[RFC7961]
	AFtrill                                  // TRILL TRILL Nickname	[RFC7455]
	AFuuid                                   // UUID Universally Unique Identifier (UUID)
	AFafir                                   // AFI Routing Policy AFI	[draft-ietf-idr-rpd-02]
	AFmplsns                                 // MPLSNS MPLS Namespaces
	AFreserved  AddressFamily = 65535        // 65535 65535	Reserved
)

func NewAddressFamily added in v0.4.34

func NewAddressFamily[T constraints.Integer](integer T) (addressFamily AddressFamily, err error)

NewAddressFamily returns iana.AddressFamily for any integer value.

  • values larger that 255 produce error testable with errors.Is(err, ints.ErrTooLarge)
  • addressFamily may be invalid, ie. not an iana-assigned value, check with addressFamily.IsValid
  • or use NewValidAddressFamily

func NewAddressFamily1 added in v0.4.34

func NewAddressFamily1[T constraints.Integer](integer T) (addressFamily AddressFamily)

NewAddressFamily1 returns iana.NewAddressFamily1 for any integer value.

  • if value is too large, panic
  • addressFamily may be invalid, ie. not an iana-assigned value, check with addressFamily.IsValid
  • or use NewValidAddressFamily

func NewValidAddressFamily added in v0.4.34

func NewValidAddressFamily[T constraints.Integer](integer T) (addressFamily AddressFamily, err error)

NewValidAddressFamily returns iana.AddressFamily for any integer value.

  • values larger that 65535 produce error testable with errors.Is(err, ints.ErrTooLarge)
  • addressFamily is valid

func (AddressFamily) Description

func (af AddressFamily) Description() (full string)

func (AddressFamily) Int added in v0.4.36

func (af AddressFamily) Int() (addressFamilyInt int)

func (AddressFamily) IsValid

func (af AddressFamily) IsValid() (isValid bool)

func (AddressFamily) String

func (af AddressFamily) String() (s string)

func (AddressFamily) StringInt added in v0.4.86

func (af AddressFamily) StringInt() (s string)

func (AddressFamily) Uint16 added in v0.4.36

func (af AddressFamily) Uint16() (addressFamilyInt uint16)

type InternetSocket added in v0.4.34

type InternetSocket string

InternetSocket is a unique named type for socket identifiers based on protocol, IP address and possibly port number.

  • InternetSocket is fmt.Stringer
  • InternetSocket is ordered

func NewInternetSocket added in v0.4.34

func NewInternetSocket(protocol Protocol, addrPort netip.AddrPort) (internetSocket InternetSocket, err error)

NewInternetSocket returns an InternetSocket socket identifier based on protocol, IP address and port

func NewInternetSocket1 added in v0.4.34

func NewInternetSocket1(protocol Protocol, addrPort netip.AddrPort) (internetSocket InternetSocket)

NewInternetSocket1 returns an InternetSocket socket identifier based on protocol, IP address and port, panics on error

func NewInternetSocketNoPort added in v0.4.34

func NewInternetSocketNoPort(protocol Protocol, addr netip.Addr) (internetSocket InternetSocket, err error)

NewInternetSocketNoPort returns an InternetSocket socket identifier based on protocol and IP address

func (InternetSocket) IsZeroValue added in v0.4.96

func (is InternetSocket) IsZeroValue() (isZeroValue bool)

func (InternetSocket) String added in v0.4.34

func (is InternetSocket) String() (s string)

type Port added in v0.4.34

type Port uint16

Port contains an iana port number 1…65535.

  • Port is ordered
  • Port implements fmt.Stringer
  • Port has IsValid, Int and Uint16 methods

func NewPort added in v0.4.34

func NewPort[T constraints.Integer](integer T) (port Port, err error)

NewPort returns iana.Port for any integer value.

  • values larger that 65535 produce error testable with errors.Is(err, ints.ErrTooLarge)
  • port may be invalid, ie. not an iana-assigned value, check with port.IsValid
  • or use NewValidPort

func NewPort1 added in v0.4.34

func NewPort1[T constraints.Integer](integer T) (port Port)

NewPort1 returns iana.Port for any integer value.

  • if value is too large, panic
  • port may be invalid, ie. not an iana-allowed value, check with port.IsValid
  • or use NewValidPort

func NewValidPort added in v0.4.34

func NewValidPort[T constraints.Integer](integer T) (port Port, err error)

NewValidPort returns iana.Port for any integer value.

  • values larger that 65535 produce error testable with errors.Is(err, ints.ErrTooLarge)
  • port is valid

func (Port) Int added in v0.4.34

func (port Port) Int() (portInt int)

func (Port) IsValid added in v0.4.34

func (port Port) IsValid() (isValid bool)

func (Port) String added in v0.4.84

func (port Port) String() (numericString string)

func (Port) Uint16 added in v0.4.34

func (port Port) Uint16() (portUint16 uint16)

type Protocol

type Protocol uint8

Protocol represents iana Assigned Internet Protocol Numbers for IPv4 and IPv6.

  • Protocol is ordered
  • Protocol implements fmt.Stringer
  • Protocol has methods IsValid Description Int Uint8

IANA protocol-numbers

const (
	IPhopopt   Protocol = iota       // IPv6 Hop-by-Hop Option IPv6xh RFC8200
	IPicmp                           // Internet Control Message RFC792
	IPigmp                           // IGMP Internet Group Management RFC1112
	IPggp                            // GGP Gateway-to-Gateway RFC823
	IPv4                             // IPv4 IPv4 encapsulation RFC2003
	IPst                             // ST Stream RFC1190 RFC1819
	IPtcp                            // TCP Transmission Control RFC9293
	IPcbt                            // CBT CBT
	IPegp                            // EGP Exterior Gateway Protocol RFC888
	IPigp                            // IGP any private interior gateway
	IPbbn                            // BBN-RCC-MON BBN RCC Monitoring
	IPnvp                            // NVP-II Network Voice Protocol RFC741
	IPpup                            // PUP PUP
	IPargus                          // ARGUS (deprecated) ARGUS
	IPemcon                          // EMCON EMCON
	IPxnet                           // XNET Cross Net Debugger
	IPchaos                          // CHAOS Chaos
	IPudp                            // UDP User Datagram RFC768
	IPmux                            // MUX Multiplexing
	IPdcn                            // DCN-MEAS DCN Measurement Subsystems
	IPhmp                            // HMP Host Monitoring RFC869
	IPprm                            // PRM Packet Radio Measurement
	IPxns                            // XNS-IDP XEROX NS IDP
	IPtrunk1                         // TRUNK-1 Trunk-1
	IPtrunk2                         // TRUNK-2 Trunk-2
	IPleaf1                          // LEAF-1 Leaf-1
	IPleaf2                          // LEAF-2 Leaf-2
	IPrdp                            // RDP Reliable Data Protocol RFC908
	IPirtp                           // IRTP Internet Reliable Transaction RFC938
	IPisotp4                         // ISO-TP4 ISO Transport Protocol Class 4 RFC905
	IPnetblt                         // NETBLT Bulk Data Transfer Protocol RFC969
	IPmfe                            // MFE-NSP MFE Network Services Protocol
	IPmerit                          // MERIT-INP MERIT Internodal Protocol
	IPdccp                           // DCCP Datagram Congestion Control Protocol RFC4340
	IP3pc                            // 3PC Third Party Connect Protocol
	IPidpr                           // IDPR Inter-Domain Policy Routing Protocol
	IPxtp                            // XTP XTP
	IPddp                            // DDP Datagram Delivery Protocol
	IPidprcmtp                       // IDPR-CMTP IDPR Control Message Transport Proto
	IPtp                             // TP++ TP++ Transport Protocol
	IPil                             // IL IL Transport Protocol
	IPv6                             // IPv6 IPv6 encapsulation RFC2473
	IPsdrp                           // SDRP Source Demand Routing Protocol
	IPv6route                        // IPv6-Route Routing Header for IPv6 IPv6xh
	IPv6frag                         // IPv6-Frag Fragment Header for IPv6 IPv6xh
	IPidrp                           // IDRP Inter-Domain Routing Protocol
	IPrsvp                           // RSVP Reservation Protocol RFC2205 RFC3209
	IPgre                            // GRE Generic Routing Encapsulation RFC2784
	IPdsr                            // DSR Dynamic Source Routing Protocol RFC4728
	IPbna                            // BNA BNA
	IPesp                            // ESP Encap Security Payload IPv6xh RFC4303
	IPah                             // AH Authentication Header IPv6xh RFC4302
	IPinlsp                          // I-NLSP Integrated Net Layer Security TUBA
	IPswipe                          // SWIPE (deprecated) IP with Encryption
	IPnarp                           // NARP NBMA Address Resolution Protocol RFC1735
	IPmobile                         // MOBILE IP Mobility
	IPtlsp                           // TLSP Transport Layer Security Protocol using Kryptonet key management
	IPskip                           // SKIP SKIP
	IPv6icmp                         // IPv6-ICMP ICMP for IPv6 RFC8200
	IPv6nonxt                        // IPv6-NoNxt No Next Header for IPv6 RFC8200
	IPv6opts                         // IPv6-Opts Destination Options for IPv6 IPv6xh RFC8200
	IPanyhost                        // ANYHOST any host internal protocol
	IPcftp                           // CFTP CFTP Network Message
	IPanynw                          // ANYNW any local network
	IPsat                            // SAT-EXPAK SATNET and Backroom EXPAK
	IPkrypto                         // KRYPTOLAN Kryptolan
	IPrvd                            // RVD MIT Remote Virtual Disk Protocol
	IPippc                           // IPPC Internet Pluribus Packet Core
	IPanyfs                          // ANYFS any distributed file system
	IPsatmon                         // SAT-MON SATNET Monitoring
	IPvisa                           // VISA VISA Protocol
	IPipcv                           // IPCV Internet Packet Core Utility
	IPcpnx                           // CPNX Computer Protocol Network Executive
	IPcphb                           // CPHB Computer Protocol Heart Beat
	IPwsn                            // WSN Wang Span Network
	IPpvp                            // PVP Packet Video Protocol
	IPbrsat                          // BR-SAT-MON Backroom SATNET Monitoring
	IPsun                            // SUN-ND SUN ND PROTOCOL
	IPwbmon                          // WB-MON WIDEBAND Monitoring
	IPwbexpak                        // WB-EXPAK WIDEBAND EXPAK
	IPisoip                          // ISO-IP ISO Internet Protocol
	IPvmtp                           // VMTP VMTP
	IPsvmtp                          // SECURE-VMTP SECURE-VMTP
	IPvines                          // VINES VINES
	IPttp                            // TTP Transaction Transport Protocol, IPTM Internet Protocol Traffic Manager
	IPnsf                            // NSFNET-IGP NSFNET-IGP
	IPdgp                            // DGP Dissimilar Gateway Protocol
	IPtcf                            // TCF TCF
	IPeigrp                          // EIGRP EIGRP RFC7868
	IPospf                           // OSPFIGP OSPFIGP RFC1583 RFC2328 RFC5340
	IPrpc                            // Sprite-RPC Sprite RPC Protocol
	IPlarp                           // LARP Locus Address Resolution Protocol
	IPmtp                            // MTP Multicast Transport Protocol
	IPax25                           // AX.25 AX.25 Frames
	IPip                             // IPIP IP-within-IP Encapsulation Protocol
	IPmicp                           // MICP (deprecated) Mobile Internetworking Control Pro.
	IPscc                            // SCC-SP Semaphore Communications Sec. Pro.
	IPether                          // ETHERIP Ethernet-within-IP Encapsulation RFC3378
	IPencap                          // ENCAP Encapsulation Header RFC1241
	IPenc                            // ENC any private encryption scheme
	IPgmtp                           // GMTP GMTP RXB5
	IPifmp                           // IFMP Ipsilon Flow Management Protocol
	IPpnni                           // PNNI PNNI over IP
	IPpim                            // PIM Protocol Independent Multicast RFC7761
	IParis                           // ARIS ARIS
	IPscps                           // SCPS SCPS
	IPqnx                            // QNX QNX
	IPan                             // A/N Active Networks
	IPcomp                           // IPComp IP Payload Compression Protocol RFC2393
	IPsnp                            // SNP Sitara Networks Protocol
	IPcq                             // Compaq-Peer Compaq Peer Protocol
	IPipx                            // IPX-in-IP IPX in IP
	IPvrrp                           // VRRP Virtual Router Redundancy Protocol RFC5798
	IPpgm                            // PGM PGM Reliable Transport Protocol
	IPany0                           // any 0-hop protocol any 0-hop protocol
	IPl2tp                           // L2TP Layer Two Tunneling Protocol RFC3931
	IPddx                            // DDX D-II Data Exchange (DDX)
	IPiatp                           // IATP Interactive Agent Transfer Protocol
	IPstp                            // STP Schedule Transfer Protocol
	IPsrp                            // SRP SpectraLink Radio Protocol
	IPuti                            // UTI UTI
	IPsmp                            // SMP Simple Message Protocol
	IPsm                             // SM (deprecated) Simple Multicast Protocol
	IPptp                            // PTP Performance Transparency Protocol
	IPisis                           // ISIS ISIS over IPv4
	IPfire                           // FIRE FIRE
	IPcrtp                           // CRTP Combat Radio Transport Protocol
	IPcrudp                          // CRUDP Combat Radio User Datagram
	IPssc                            // SSCOPMCE SSCOPMCE
	IPlt                             // IPLT IPLT
	IPsps                            // SPS Secure Packet Shield
	IPpipe                           // PIPE Private IP Encapsulation within IP
	IPsctp                           // SCTP Stream Control Transmission Protocol
	IPfc                             // FC Fibre Channel Murali_Rajagopal RFC6172
	IPrsvpi                          // RSVP RSVP-E2E-IGNORE  RFC3175
	IPmobility                       // MOBILITY Mobility Header IPv6xh RFC6275
	IPudplite                        // UDPLite UDPLite RFC3828
	IPmpls                           // MPLS-in-IP MPLS-in-IP RFC4023
	IPmanet                          // manet MANET Protocols RFC5498
	IPhip                            // HIP Host Identity Protocol IPv6xh RFC7401
	IPshim6                          // Shim6 Shim6 Protocol IPv6xh RFC5533
	IPwesp                           // WESP Wrapped Encapsulating Security Payload RFC5840
	IProhc                           // ROHC Robust Header Compression RFC5858
	IPeth                            // Ethernet Ethernet RFC8986
	IPagg                            // AGGFRAG AGGFRAG encapsulation payload for ESP RFC-ietf-ipsecme-iptfs-19
	IP253      Protocol = 108 + iota // 253 Use for experimentation and testing IPv6xh RFC3692
	IP254                            // 254 Use for experimentation and testing IPv6xh RFC3692
	IP255                            // Reserved Reserved
)

func NewProtocol added in v0.4.34

func NewProtocol[T constraints.Integer](integer T) (protocol Protocol, err error)

NewProtocol returns iana.Protocol for any integer value.

  • values larger that 255 produce error testable with errors.Is(err, ints.ErrTooLarge)
  • protocol may be invalid, ie. not an iana-assigned value, check with protocol.IsValid
  • or use NewValidProtocol

func NewProtocol1 added in v0.4.34

func NewProtocol1[T constraints.Integer](integer T) (protocol Protocol)

NewProtocol returns iana.Protocol for any integer value.

  • if value is too large, panic
  • protocol may be invalid, ie. not an iana-assigned value, check with protocol.IsValid
  • or use NewValidProtocol

func NewValidProtocol added in v0.4.34

func NewValidProtocol[T constraints.Integer](integer T) (protocol Protocol, err error)

NewProtocol returns iana.Protocol for any integer value.

  • values larger that 255 produce error testable with errors.Is(err, ints.ErrTooLarge)
  • protocol is valid

func (Protocol) Description

func (pr Protocol) Description() (full string)

Description returns a sentence describing protocol

func (Protocol) Int added in v0.4.36

func (pr Protocol) Int() (protocolInt int)

func (Protocol) IsValid

func (pr Protocol) IsValid() (isValid bool)

func (Protocol) String

func (pr Protocol) String() (s string)

func (Protocol) Uint8 added in v0.4.36

func (pr Protocol) Uint8() (protocolInt uint8)

Jump to

Keyboard shortcuts

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