mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 22:36:53 +00:00
15 lines
236 B
Go
15 lines
236 B
Go
|
package handler
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func setConnectionTimeout(conn *net.TCPConn, timeout int) error {
|
||
|
if timeout <= 0 {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
return conn.SetReadDeadline(time.Now().Add(time.Millisecond * time.Duration(timeout)))
|
||
|
}
|