Documentation ¶
Index ¶
Constants ¶
View Source
const ( DEFAULT_VERSION = 4 MIN_IP_HEADER_LENGTH = 5 ICMP_PROTO = 1 ECHO_REQUEST = 8 NO_FRAGMENT = 2 MAX_TTL = 255 DEFAULT_TIMEOUT = 2 )
Variables ¶
This section is empty.
Functions ¶
func ParseTimestamp ¶
Types ¶
type IcmpProto ¶
type IcmpProto struct { Type uint8 Code uint8 Checksum uint16 Identifier uint16 SequenceNumber uint16 Data []byte }
func NewIcmpProto ¶
func NewIcmpProto() *IcmpProto
func (*IcmpProto) ClearChecksum ¶
func (packet *IcmpProto) ClearChecksum()
func (*IcmpProto) ComputeChecksum ¶
func (packet *IcmpProto) ComputeChecksum()
func (*IcmpProto) SetSequenceNumber ¶
func (*IcmpProto) SetTimestamp ¶
func (packet *IcmpProto) SetTimestamp()
type IcmpReply ¶
type IcmpReply struct { IpHeader *IpProtoHeader Reply *IcmpProto }
type IcmpRequest ¶
type IcmpRequest struct { IpHeader *IpProtoHeader Request *IcmpProto }
func NewIcmpRequest ¶
func NewIcmpRequest(dst net.IP) *IcmpRequest
func (*IcmpRequest) SendRequest ¶
func (icmp *IcmpRequest) SendRequest(dstAddr [4]byte) *IcmpReply
func (*IcmpRequest) ToBytes ¶
func (icmpReq *IcmpRequest) ToBytes() []byte
type IpProtoHeader ¶
type IpProtoHeader struct { Version uint8 IHL uint8 TypeOfService uint8 TotalLength uint16 Identifier uint16 Flags uint16 FragmentOffset uint16 TTL uint8 Protocol uint8 Checksum uint16 SrcAddr net.IP DstAddr net.IP }
func NewIPHeader ¶
func NewIPHeader(dstAddr net.IP) *IpProtoHeader
func (*IpProtoHeader) ToBytes ¶
func (ipProto *IpProtoHeader) ToBytes() []byte
type Statistics ¶
func NewStatistics ¶
func NewStatistics() *Statistics
func (*Statistics) IncrementReceived ¶
func (stats *Statistics) IncrementReceived()
func (*Statistics) IncrementTransmitted ¶
func (stats *Statistics) IncrementTransmitted()
func (*Statistics) PrettyStats ¶
func (stats *Statistics) PrettyStats(dstAddr string)
func (*Statistics) SetTotalTime ¶
func (stats *Statistics) SetTotalTime(startTime time.Time)
Click to show internal directories.
Click to hide internal directories.