https://github.com/xaionaro-go/udpnofrag
Disable UDP fragmentation
https://github.com/xaionaro-go/udpnofrag
disable do frag fragment fragmentation go golang no nofrag not udp
Last synced: 6 months ago
JSON representation
Disable UDP fragmentation
- Host: GitHub
- URL: https://github.com/xaionaro-go/udpnofrag
- Owner: xaionaro-go
- License: cc0-1.0
- Created: 2020-06-01T10:52:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T11:54:04.000Z (about 6 years ago)
- Last Synced: 2025-02-27T04:17:23.779Z (over 1 year ago)
- Topics: disable, do, frag, fragment, fragmentation, go, golang, no, nofrag, not, udp
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/xaionaro-go/udpnofrag?tab=doc)
[](https://goreportcard.com/report/github.com/xaionaro-go/udpnofrag)
[](https://travis-ci.org/xaionaro-go/udpnofrag)
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".
# Quick start
```go
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)
}
}
```
```sh
$ 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
```