mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-06 20:10:11 +02:00
be92aa2ac4
- Existing option `WIREGUARD_MTU` , if set, disables PMTUD and is used - New option `PMTUD_ICMP_ADDRESSES=1.1.1.1,8.8.8.8` and `PMTUD_TCP_ADDRESSES=1.1.1.1:443,8.8.8.8:443` - ICMP PMTUD now targets external-by-default IP addresses - New TCP PMTUD (binary search only) as a second MTU confirmation and fallback mechanism. - Force set TCP MSS to MTU - IP header - TCP base header - "magic 20 bytes" 🎆 - Fix #3108
29 lines
761 B
Go
29 lines
761 B
Go
//go:build linux || darwin
|
|
|
|
package tcp
|
|
|
|
import (
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
// fileDescriptor is a platform-independent type for socket file descriptors.
|
|
type fileDescriptor int
|
|
|
|
func sendTo(fd fileDescriptor, p []byte, flags int, to syscall.Sockaddr) (err error) {
|
|
return syscall.Sendto(int(fd), p, flags, to)
|
|
}
|
|
|
|
func setSocketTimeout(fd fileDescriptor, timeout time.Duration) (err error) {
|
|
timeval := syscall.NsecToTimeval(timeout.Nanoseconds())
|
|
return syscall.SetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVTIMEO, &timeval)
|
|
}
|
|
|
|
func recvFrom(fd fileDescriptor, p []byte, flags int) (n int, from syscall.Sockaddr, err error) {
|
|
return syscall.Recvfrom(int(fd), p, flags)
|
|
}
|
|
|
|
func setNonBlock(fd int) error {
|
|
return syscall.SetNonblock(fd, true)
|
|
}
|