mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
16 lines
255 B
Go
16 lines
255 B
Go
|
//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,
|
||
|
})
|
||
|
}
|
||
|
}
|