Documentation ¶
Index ¶
- func Checksum(body *[]byte, srcIP, dstIP net.IP) error
- type ICMP
- type ICMPNeighborAdvertisement
- func (oc *ICMPNeighborAdvertisement) AddOption(o ICMPOption)
- func (oc ICMPNeighborAdvertisement) GetOption(t ICMPOptionType) (*ICMPOption, error)
- func (oc ICMPNeighborAdvertisement) HasOption(t ICMPOptionType) bool
- func (p ICMPNeighborAdvertisement) Marshal() ([]byte, error)
- func (p ICMPNeighborAdvertisement) String() string
- func (p ICMPNeighborAdvertisement) Type() ipv6.ICMPType
- type ICMPNeighborSolicitation
- func (oc *ICMPNeighborSolicitation) AddOption(o ICMPOption)
- func (oc ICMPNeighborSolicitation) GetOption(t ICMPOptionType) (*ICMPOption, error)
- func (oc ICMPNeighborSolicitation) HasOption(t ICMPOptionType) bool
- func (p ICMPNeighborSolicitation) Marshal() ([]byte, error)
- func (p ICMPNeighborSolicitation) String() string
- func (p ICMPNeighborSolicitation) Type() ipv6.ICMPType
- type ICMPOption
- type ICMPOptionDNSSearchList
- type ICMPOptionMTU
- type ICMPOptionNonce
- type ICMPOptionPrefixInformation
- type ICMPOptionRecursiveDNSServer
- type ICMPOptionSourceLinkLayerAddress
- type ICMPOptionTargetLinkLayerAddress
- type ICMPOptionType
- type ICMPOptionUnknown
- type ICMPOptions
- type ICMPRouterAdvertisement
- func (oc *ICMPRouterAdvertisement) AddOption(o ICMPOption)
- func (oc ICMPRouterAdvertisement) GetOption(t ICMPOptionType) (*ICMPOption, error)
- func (oc ICMPRouterAdvertisement) HasOption(t ICMPOptionType) bool
- func (p ICMPRouterAdvertisement) Marshal() ([]byte, error)
- func (p ICMPRouterAdvertisement) String() string
- func (p ICMPRouterAdvertisement) Type() ipv6.ICMPType
- type ICMPRouterSolicitation
- func (oc *ICMPRouterSolicitation) AddOption(o ICMPOption)
- func (oc ICMPRouterSolicitation) GetOption(t ICMPOptionType) (*ICMPOption, error)
- func (oc ICMPRouterSolicitation) HasOption(t ICMPOptionType) bool
- func (p ICMPRouterSolicitation) Marshal() ([]byte, error)
- func (p ICMPRouterSolicitation) String() string
- func (p ICMPRouterSolicitation) Type() ipv6.ICMPType
- type RouterPreferenceField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ICMP ¶
ICMP implements an interface to base various ICMPv6 packets on
func ParseMessage ¶
ParseMessage returns ICMP and its ICMPOptions for given bytes or error if it couldn't parse it
type ICMPNeighborAdvertisement ¶
type ICMPNeighborAdvertisement struct { Router bool Solicited bool Override bool TargetAddress net.IP // contains filtered or unexported fields }
ICMPNeighborAdvertisement implements the Neighbor Advertisement message as described at https://tools.ietf.org/html/rfc4861#section-4.4
func (*ICMPNeighborAdvertisement) AddOption ¶
func (oc *ICMPNeighborAdvertisement) AddOption(o ICMPOption)
AddOption adds given ICMPOption to options of ICMP
func (ICMPNeighborAdvertisement) GetOption ¶
func (oc ICMPNeighborAdvertisement) GetOption(t ICMPOptionType) (*ICMPOption, error)
GetOption returns ICMPOption of type ICMPOptionType or error if ICMP has no such option
func (ICMPNeighborAdvertisement) HasOption ¶
func (oc ICMPNeighborAdvertisement) HasOption(t ICMPOptionType) bool
HasOption returns true if ICMP contains option of type ICMPOptionType
func (ICMPNeighborAdvertisement) Marshal ¶
func (p ICMPNeighborAdvertisement) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPNeighborAdvertisement
func (ICMPNeighborAdvertisement) String ¶
func (p ICMPNeighborAdvertisement) String() string
func (ICMPNeighborAdvertisement) Type ¶
func (p ICMPNeighborAdvertisement) Type() ipv6.ICMPType
Type returns ipv6.ICMPTypeNeighborAdvertisement
type ICMPNeighborSolicitation ¶
type ICMPNeighborSolicitation struct { TargetAddress net.IP // contains filtered or unexported fields }
ICMPNeighborSolicitation implements the Neighbor Solicitation message as described at https://tools.ietf.org/html/rfc4861#section-4.3
func (*ICMPNeighborSolicitation) AddOption ¶
func (oc *ICMPNeighborSolicitation) AddOption(o ICMPOption)
AddOption adds given ICMPOption to options of ICMP
func (ICMPNeighborSolicitation) GetOption ¶
func (oc ICMPNeighborSolicitation) GetOption(t ICMPOptionType) (*ICMPOption, error)
GetOption returns ICMPOption of type ICMPOptionType or error if ICMP has no such option
func (ICMPNeighborSolicitation) HasOption ¶
func (oc ICMPNeighborSolicitation) HasOption(t ICMPOptionType) bool
HasOption returns true if ICMP contains option of type ICMPOptionType
func (ICMPNeighborSolicitation) Marshal ¶
func (p ICMPNeighborSolicitation) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPNeighborSolicitation
func (ICMPNeighborSolicitation) String ¶
func (p ICMPNeighborSolicitation) String() string
func (ICMPNeighborSolicitation) Type ¶
func (p ICMPNeighborSolicitation) Type() ipv6.ICMPType
Type returns ipv6.ICMPTypeNeighborSolicitation
type ICMPOption ¶
type ICMPOption interface { String() string Len() uint8 Marshal() ([]byte, error) Type() ICMPOptionType }
ICMPOption implements an interface to base various ICMPv6 options on
type ICMPOptionDNSSearchList ¶
ICMPOptionDNSSearchList implements the DNS Search List option as described at https://tools.ietf.org/html/rfc6106#section-5.2
func (ICMPOptionDNSSearchList) Len ¶
func (o ICMPOptionDNSSearchList) Len() uint8
Len returns the length in bytes of ICMPOptionDNSSearchList
func (ICMPOptionDNSSearchList) Marshal ¶
func (o ICMPOptionDNSSearchList) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionDNSSearchList
func (ICMPOptionDNSSearchList) String ¶
func (o ICMPOptionDNSSearchList) String() string
String implements the String method of ICMPOption interface.
func (ICMPOptionDNSSearchList) Type ¶
func (o ICMPOptionDNSSearchList) Type() ICMPOptionType
Type returns ICMPOptionTypeDNSSearchList
type ICMPOptionMTU ¶
type ICMPOptionMTU struct {
MTU uint32
}
ICMPOptionMTU implements the MTU option as described at https://tools.ietf.org/html/rfc4861#section-4.6.4
func (ICMPOptionMTU) Len ¶
func (o ICMPOptionMTU) Len() uint8
Len returns the length in bytes of ICMPOptionMTU
func (*ICMPOptionMTU) Marshal ¶
func (o *ICMPOptionMTU) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionMTU
func (ICMPOptionMTU) String ¶
func (o ICMPOptionMTU) String() string
String implements the String method of ICMPOption interface.
func (ICMPOptionMTU) Type ¶
func (o ICMPOptionMTU) Type() ICMPOptionType
Type returns ICMPOptionTypeMTU
type ICMPOptionNonce ¶
type ICMPOptionNonce struct {
Nonce uint64
}
ICMPOptionNonce implements the Nonce option as described at https://tools.ietf.org/html/rfc3971#section-5.3.2
func (ICMPOptionNonce) Len ¶
func (o ICMPOptionNonce) Len() uint8
Len returns the length in bytes of ICMPOptionNonce
func (ICMPOptionNonce) Marshal ¶
func (o ICMPOptionNonce) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionNonce
func (ICMPOptionNonce) String ¶
func (o ICMPOptionNonce) String() string
String implements the String method of ICMPOption interface.
func (ICMPOptionNonce) Type ¶
func (o ICMPOptionNonce) Type() ICMPOptionType
Type returns ICMPOptionTypeNonce
type ICMPOptionPrefixInformation ¶
type ICMPOptionPrefixInformation struct { PrefixLength uint8 OnLink bool Auto bool ValidLifetime uint32 PreferredLifetime uint32 Prefix net.IP }
ICMPOptionPrefixInformation implements the Prefix Information option as described at https://tools.ietf.org/html/rfc4861#section-4.6.2
func (ICMPOptionPrefixInformation) Len ¶
func (o ICMPOptionPrefixInformation) Len() uint8
Len returns the length in bytes of ICMPOptionPrefixInformation
func (ICMPOptionPrefixInformation) Marshal ¶
func (o ICMPOptionPrefixInformation) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionPrefixInformation
func (ICMPOptionPrefixInformation) String ¶
func (o ICMPOptionPrefixInformation) String() string
String implements the String method of ICMPOption interface.
func (ICMPOptionPrefixInformation) Type ¶
func (o ICMPOptionPrefixInformation) Type() ICMPOptionType
Type returns ICMPOptionTypePrefixInformation
type ICMPOptionRecursiveDNSServer ¶
ICMPOptionRecursiveDNSServer implements the Recursive DNS Server option as described at https://tools.ietf.org/html/rfc6106#section-5.1
func (ICMPOptionRecursiveDNSServer) Len ¶
func (o ICMPOptionRecursiveDNSServer) Len() uint8
Len returns the length in bytes of ICMPOptionRecursiveDNSServer
func (ICMPOptionRecursiveDNSServer) Marshal ¶
func (o ICMPOptionRecursiveDNSServer) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionRecursiveDNSServer
func (ICMPOptionRecursiveDNSServer) String ¶
func (o ICMPOptionRecursiveDNSServer) String() string
String implements the String method of ICMPOption interface.
func (ICMPOptionRecursiveDNSServer) Type ¶
func (o ICMPOptionRecursiveDNSServer) Type() ICMPOptionType
Type returns ICMPOptionTypeRecursiveDNSServer
type ICMPOptionSourceLinkLayerAddress ¶
type ICMPOptionSourceLinkLayerAddress struct {
LinkLayerAddress net.HardwareAddr
}
ICMPOptionSourceLinkLayerAddress implements the Source Linklayer Address option as described at https://tools.ietf.org/html/rfc4861#section-4.6.1
func (ICMPOptionSourceLinkLayerAddress) Len ¶
func (o ICMPOptionSourceLinkLayerAddress) Len() uint8
Len returns the length in bytes of ICMPOptionSourceLinkLayerAddress
func (ICMPOptionSourceLinkLayerAddress) Marshal ¶
func (o ICMPOptionSourceLinkLayerAddress) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionSourceLinkLayerAddress
func (ICMPOptionSourceLinkLayerAddress) String ¶
func (o ICMPOptionSourceLinkLayerAddress) String() string
func (ICMPOptionSourceLinkLayerAddress) Type ¶
func (o ICMPOptionSourceLinkLayerAddress) Type() ICMPOptionType
Type returns ICMPOptionTypeSourceLinkLayerAddress
type ICMPOptionTargetLinkLayerAddress ¶
type ICMPOptionTargetLinkLayerAddress struct {
LinkLayerAddress net.HardwareAddr
}
ICMPOptionTargetLinkLayerAddress implements the Target Linklayer Address option as described at https://tools.ietf.org/html/rfc4861#section-4.6.1
func (ICMPOptionTargetLinkLayerAddress) Len ¶
func (o ICMPOptionTargetLinkLayerAddress) Len() uint8
Len returns the length in bytes of ICMPOptionTargetLinkLayerAddress
func (ICMPOptionTargetLinkLayerAddress) Marshal ¶
func (o ICMPOptionTargetLinkLayerAddress) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionTargetLinkLayerAddress
func (ICMPOptionTargetLinkLayerAddress) String ¶
func (o ICMPOptionTargetLinkLayerAddress) String() string
func (ICMPOptionTargetLinkLayerAddress) Type ¶
func (o ICMPOptionTargetLinkLayerAddress) Type() ICMPOptionType
Type returns ICMPOptionTypeTargetLinkLayerAddress
type ICMPOptionType ¶
type ICMPOptionType int
ICMPOptionType describes ICMPv6 types
const ( ICMPOptionTypeUnknown ICMPOptionType = iota // RFC4861 ICMPOptionTypeSourceLinkLayerAddress ICMPOptionTypeTargetLinkLayerAddress ICMPOptionTypePrefixInformation ICMPOptionTypeMTU // RFC3971 ICMPOptionTypeNonce ICMPOptionType = 14 // RFC6106 ICMPOptionTypeRecursiveDNSServer ICMPOptionType = 25 ICMPOptionTypeDNSSearchList ICMPOptionType = 31 )
ICMPv6 Neighbor discovery types as described in RFC4861, RFC3971, RFC6106
func (ICMPOptionType) String ¶
func (t ICMPOptionType) String() string
type ICMPOptionUnknown ¶
type ICMPOptionUnknown struct {
// contains filtered or unexported fields
}
ICMPOptionUnknown implements generic type for handling unknown options
func (ICMPOptionUnknown) Len ¶
func (o ICMPOptionUnknown) Len() uint8
Len returns known length for this option
func (ICMPOptionUnknown) Marshal ¶
func (o ICMPOptionUnknown) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPOptionUnknown
func (ICMPOptionUnknown) String ¶
func (o ICMPOptionUnknown) String() string
func (ICMPOptionUnknown) Type ¶
func (o ICMPOptionUnknown) Type() ICMPOptionType
Type returns apparent type of this option
type ICMPOptions ¶
type ICMPOptions []ICMPOption
ICMPOptions is a type wrapper for a slice of ICMPOptions
func (ICMPOptions) Marshal ¶
func (opts ICMPOptions) Marshal() ([]byte, error)
Marshal is a helper function of ICMPOptions and returns marshalled results for all ICMPOptions or error when there is one
type ICMPRouterAdvertisement ¶
type ICMPRouterAdvertisement struct { HopLimit uint8 ManagedAddress bool OtherStateful bool HomeAgent bool RouterPreference RouterPreferenceField RouterLifeTime uint16 ReachableTime uint32 RetransTimer uint32 // contains filtered or unexported fields }
ICMPRouterAdvertisement implements the Router Advertisement message as described at https://tools.ietf.org/html/rfc4861#section-4.2
func (*ICMPRouterAdvertisement) AddOption ¶
func (oc *ICMPRouterAdvertisement) AddOption(o ICMPOption)
AddOption adds given ICMPOption to options of ICMP
func (ICMPRouterAdvertisement) GetOption ¶
func (oc ICMPRouterAdvertisement) GetOption(t ICMPOptionType) (*ICMPOption, error)
GetOption returns ICMPOption of type ICMPOptionType or error if ICMP has no such option
func (ICMPRouterAdvertisement) HasOption ¶
func (oc ICMPRouterAdvertisement) HasOption(t ICMPOptionType) bool
HasOption returns true if ICMP contains option of type ICMPOptionType
func (ICMPRouterAdvertisement) Marshal ¶
func (p ICMPRouterAdvertisement) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPRouterAdvertisement
func (ICMPRouterAdvertisement) String ¶
func (p ICMPRouterAdvertisement) String() string
func (ICMPRouterAdvertisement) Type ¶
func (p ICMPRouterAdvertisement) Type() ipv6.ICMPType
Type returns ipv6.ICMPTypeRouterAdvertisement
type ICMPRouterSolicitation ¶
type ICMPRouterSolicitation struct {
// contains filtered or unexported fields
}
ICMPRouterSolicitation implements the Router Solicitation message as described at https://tools.ietf.org/html/rfc4861#section-4.1
func (*ICMPRouterSolicitation) AddOption ¶
func (oc *ICMPRouterSolicitation) AddOption(o ICMPOption)
AddOption adds given ICMPOption to options of ICMP
func (ICMPRouterSolicitation) GetOption ¶
func (oc ICMPRouterSolicitation) GetOption(t ICMPOptionType) (*ICMPOption, error)
GetOption returns ICMPOption of type ICMPOptionType or error if ICMP has no such option
func (ICMPRouterSolicitation) HasOption ¶
func (oc ICMPRouterSolicitation) HasOption(t ICMPOptionType) bool
HasOption returns true if ICMP contains option of type ICMPOptionType
func (ICMPRouterSolicitation) Marshal ¶
func (p ICMPRouterSolicitation) Marshal() ([]byte, error)
Marshal returns byte slice representing this ICMPRouterSolicitation
func (ICMPRouterSolicitation) String ¶
func (p ICMPRouterSolicitation) String() string
func (ICMPRouterSolicitation) Type ¶
func (p ICMPRouterSolicitation) Type() ipv6.ICMPType
Type returns ipv6.ICMPTypeRouterSolicitation
type RouterPreferenceField ¶
type RouterPreferenceField int
RouterPreferenceField implements the Router Preference Values as described at https://tools.ietf.org/html/rfc4191#section-2.1
const ( RouterPreferenceMedium RouterPreferenceField = iota RouterPreferenceHigh RouterPreferenceLow )
types currently defined
func (RouterPreferenceField) String ¶
func (typ RouterPreferenceField) String() string