config.go 425 B

12345678910111213141516
  1. package udp
  2. import "sync/atomic"
  3. var disableUDPCsum atomic.Bool
  4. // SetDisableUDPCsum controls whether IPv4 UDP sockets opt out of kernel
  5. // checksum calculation via SO_NO_CHECK. Only applicable on platforms that
  6. // support the option (Linux). IPv6 always keeps the checksum enabled.
  7. func SetDisableUDPCsum(disable bool) {
  8. disableUDPCsum.Store(disable)
  9. }
  10. func udpChecksumDisabled() bool {
  11. return disableUDPCsum.Load()
  12. }