Turns out internet MTU must be honored, otherwise packets are dropped/not reassembled. Setting to 1500 bytes for transfer messages.

This commit is contained in:
Kleissner
2021-11-05 03:39:46 +01:00
parent 0d62c215ee
commit 14f034cc8d
3 changed files with 5 additions and 2 deletions

View File

@@ -26,6 +26,9 @@ type MessageRaw struct {
// However, due to the MTU soft limit and fragmentation, packets should be as small as possible.
const udpMaxPacketSize = 65507
// internetSafeMTU is a value relatively safe to use for transmitting over the internet
const internetSafeMTU = 1500 - 20 - 8
// isPacketSizeExceed checks if the max packet size would be exceeded with the payload
func isPacketSizeExceed(currentSize int, testSize int) bool {
return currentSize+testSize > udpMaxPacketSize-PacketLengthMin