Skip to content

xaionaro-go/udpnofrag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc go report Build Status

CC0
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

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