Closed QQ2017 closed 3 years ago
The docs list the Size
field which is what you want:
pinger, _ := ping.NewPinger("1.1.1.1")
pinger.Count = 3
pinger.Size = 1490
pinger.SetPrivileged(true)
pinger.Run()
fmt.Println(pinger.Statistics())
That being said, I wouldn't set a Size
that's bigger than 1472 because otherwise you'll likely go over your network MTU and cause packet fragmentation. 1472-byte ICMP message + 8-byte message header + 20-byte IP header = 1500 ethernet MTU. Note that this isn't a hard & fast rule and that your network MTU may be lower, for example if your connection uses PPPoE.
I've just had a look at the code and there is a bug in the deserialisation of ICMP messages larger than 512 bytes; I'll open a separate ticket for that.
How to send packets larger than 1490 on the windows platform?