icmp

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProtocolICMP = 1
)

Variables

This section is empty.

Functions

func Chunks

func Chunks(s string, chunkSize int) []string

Return a slice of a the string chunked with specific length (string length of each chunk) Thanks to https://stackoverflow.comProtocolICMP/questions/25686109/split-string-by-length-in-golang

func GetMessageSizeAndSender

func GetMessageSizeAndSender(listenAddr string) (size int, sender string)

Wait for the fistr ICMP packet setting sized of data

func IcmpSendAndWaitForReply

func IcmpSendAndWaitForReply(listeningReplyAddr string, remoteAddr string, data string) (*net.IPAddr, time.Duration, error)

Mostly based on https://github.com/golang/net/blob/master/icmp/ping_test.go Send ICMP echo request packet (code 8) to remote and waiting for the echo reply (code 0)

func IcmpSendRaw

func IcmpSendRaw(listeningReplyAddr string, remoteAddr string, data string) (*net.IPAddr, error)

Mostly based on https://github.com/golang/net/blob/master/icmp/ping_test.go Send ICMP echo request packet (code 8) to remote and waiting for the echo reply (code 0)

func IntegrityCheck

func IntegrityCheck(hash string)

Wait ICMP message from remote to assert if the message is well received

func SendHashedmessage

func SendHashedmessage(msg string, remoteAddr string, listenAddr string)

func SendNoReply

func SendNoReply(listeningReplyAddr string, remoteAddr string, chunkSize int, delay int, data string)

Send string to remote using ICMP and waiting for echo reply. You must specify the delay between each packet and the size

func SendReply

func SendReply(listeningReplyAddr string, remoteAddr string, chunkSize int, delay int, data string)

Send string to remote using ICMP and waiting for echo reply. You must specify the delay between each packet and the size

func SendWhileNoEchoReply

func SendWhileNoEchoReply(listeningReplyAddr string, remoteAddr string, data string)

Send echo the same echo packet while we do not received an echo reply

func Serve

func Serve(listenAddr string, n int, progressBar bool) (data string, missingPacketIndexes []int)

ICMP server waiting for packet (waiting n packet)

func ServeTemporary

func ServeTemporary(listenAddr string, n int, progressBar bool, delay int) (data string, missingPacketIndexes []int)

ICMP server waiting for specific number of packet (waiting n packet) but that stop working after (n+2)*delay seconds return a string with the data section of each packet concatened and the index of the packet missing

Types

This section is empty.

Jump to

Keyboard shortcuts

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