To the extent possible under law,
Dmitrii Okunev
has waived all copyright and related or neighboring rights to
"A package to disable UDP fragmentation.
This work is published from:
Ireland".
package main
import (
"log"
"net"
"github.com/xaionaro-go/udpnofrag"
)
func main() {
conn, err := net.DialUDP("udp", nil, &net.UDPAddr{
IP:net.ParseIP("192.168.0.1"),
Port:443,
})
if err != nil {
log.Fatal(err)
}
err = udpnofrag.UDPSetNoFragment(conn)
if err != nil {
log.Fatal(err)
}
b := make([]byte, 4096)
_, err = conn.Write(b)
if err != nil {
log.Fatal(err)
}
}
$ go run ./example.go
2020/06/01 11:43:04 write udp 192.168.0.129:60695->192.168.0.1:443: write: message too long
exit status 1