icmp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TargetIP    *net.IPAddr
	ListenIP    string
	BlockSize   = 1200
	VerboseMode bool
)

Functions

func CombineInt8

func CombineInt8(high, low uint8) uint16

Combine (hign uint8, low uint8) and return uint16.

func GetIP

func GetIP(hostname string) string

Get IP address of hostname

func IsIPv4

func IsIPv4(address string) bool

Return true if address is IPv4.

func IsIPv6

func IsIPv6(address string) bool

Return true if address is IPv6.

func MessageRead

func MessageRead(c *icmp.PacketConn) (*string, error)

Read message from ICMP.

func MessageSend

func MessageSend(c *icmp.PacketConn, message *string)

Send message to TargetIP using ICMP.

func RawMessageSend

func RawMessageSend(c *icmp.PacketConn, message *string, id uint16, seq uint16, mtype icmp.Type, code int)

func SetListenIP

func SetListenIP(hostname string)

Set the value of ListenIP.

func SetTargetIP

func SetTargetIP(hostname string)

Set the value of TargetIP.

func SplitInt16

func SplitInt16(i uint16) (uint8, uint8)

Split uint16 in to two uint8, return (hign uint8, low uint8).

Types

type MessageData

type MessageData struct {
	Type     int
	Code     int
	Checksum int
	Id       int
	Seq      int
	Data     []byte
	DataLen  int
	IP       string
}

func RawMessageRead

func RawMessageRead(c *icmp.PacketConn) MessageData

Jump to

Keyboard shortcuts

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