SpoofDPI/proxy/handler/conn.go

15 lines
236 B
Go
Raw Normal View History

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)))
}