mihomo/common/net/tcp_keepalive_go123.go

16 lines
255 B
Go
Raw Normal View History

//go:build go1.23
package net
import "net"
func TCPKeepAlive(c net.Conn) {
if tcp, ok := c.(*net.TCPConn); ok {
_ = tcp.SetKeepAliveConfig(net.KeepAliveConfig{
Enable: true,
Idle: KeepAliveIdle,
Interval: KeepAliveInterval,
})
}
}