ipproto

package
v1.66.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: BSD-3-Clause Imports: 4 Imported by: 34

Documentation

Overview

Package ipproto contains IP Protocol constants.

Index

Constants

View Source
const (
	Version4 = 4
	Version6 = 6
)

Valid Version values.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proto

type Proto uint8

Proto is an IP subprotocol as defined by the IANA protocol numbers list (https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml), or the special values Unknown or Fragment.

const (
	// Unknown represents an unknown or unsupported protocol; it's
	// deliberately the zero value. Strictly speaking the zero
	// value is IPv6 hop-by-hop extensions, but we don't support
	// those, so this is still technically correct.
	Unknown Proto = 0x00

	// Values from the IANA registry.
	ICMPv4 Proto = 0x01
	IGMP   Proto = 0x02
	ICMPv6 Proto = 0x3a
	TCP    Proto = 0x06
	UDP    Proto = 0x11
	DCCP   Proto = 0x21
	GRE    Proto = 0x2f
	SCTP   Proto = 0x84

	// TSMP is the Tailscale Message Protocol (our ICMP-ish
	// thing), an IP protocol used only between Tailscale nodes
	// (still encrypted by WireGuard) that communicates why things
	// failed, etc.
	//
	// Proto number 99 is reserved for "any private encryption
	// scheme". We never accept these from the host OS stack nor
	// send them to the host network stack. It's only used between
	// nodes.
	TSMP Proto = 99

	// Fragment represents any non-first IP fragment, for which we
	// don't have the sub-protocol header (and therefore can't
	// figure out what the sub-protocol is).
	//
	// 0xFF is reserved in the IANA registry, so we steal it for
	// internal use.
	Fragment Proto = 0xFF
)

func (Proto) MarshalJSON added in v1.52.0

func (p Proto) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Proto) MarshalText added in v1.52.0

func (p Proto) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Proto) String deprecated

func (p Proto) String() string

Deprecated: use MarshalText instead.

func (*Proto) UnmarshalJSON added in v1.52.0

func (p *Proto) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler. If the input is empty, p is set to 0. If an error occurs, p is unchanged. The input must be a JSON number or an accepted string name.

func (*Proto) UnmarshalText added in v1.52.0

func (p *Proto) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler. If the input is empty, p is set to 0. If an error occurs, p is unchanged.

type Version added in v1.52.0

type Version uint8

Version describes the IP address version.

func (Version) String added in v1.52.0

func (p Version) String() string

Jump to

Keyboard shortcuts

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