ping

package
v0.0.0-...-f91a516 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ping This package is used to send an ICMP echo request to a given address and return the time it took to get a reply.

Index

Constants

This section is empty.

Variables

View Source
var (
	// IPType4 is the type of IP address to use for IPv4
	IPType4 = IPType{
		Type:               "4",
		ListenAddr:         "0.0.0.0",
		Network:            "ip4",
		ICMPNetwork:        "ip4:icmp",
		ProtocolNumber:     1,
		RequestMessageType: ipv4.ICMPTypeEcho,
		ReplyMessageType:   ipv4.ICMPTypeEchoReply,
	}
	// IPType6 is the type of IP address to use for IPv6
	IPType6 = IPType{
		Type:               "6",
		ListenAddr:         "::",
		Network:            "ip6",
		ICMPNetwork:        "ip6:ipv6-icmp",
		ProtocolNumber:     58,
		RequestMessageType: ipv6.ICMPTypeEchoRequest,
		ReplyMessageType:   ipv6.ICMPTypeEchoReply,
	}
)

Functions

func New

func New(address string) (*net.IPAddr, time.Duration, error)

New sends an ICMP echo request to a given address and returns the time it took to get a reply

Types

type IPType

type IPType struct {
	Type               string
	ListenAddr         string
	Network            string
	ICMPNetwork        string
	ProtocolNumber     int
	RequestMessageType icmp.Type
	ReplyMessageType   icmp.Type
}

IPType is a struct that contains the type of IP address to use

Jump to

Keyboard shortcuts

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