Files
upnp-1/ttl_unix.go
2020-11-12 07:43:37 -05:00

19 lines
284 B
Go

// +build linux
package upnp
import (
"net"
"syscall"
)
func setTTL(conn *net.UDPConn, ttl int) error {
f, err := conn.File()
if err != nil {
return err
}
defer f.Close()
fd := int(f.Fd())
return syscall.SetsockoptInt(fd, syscall.SOL_IP, syscall.IP_MULTICAST_TTL, ttl)
}