mirror of
https://github.com/inverse-inc/upnp.git
synced 2025-12-24 12:12:37 +08:00
19 lines
284 B
Go
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)
|
|
}
|