diff --git a/adapter/outboundgroup/http2ping/README.md b/adapter/outboundgroup/http2ping/README.md index f4816c22..08074eea 100644 --- a/adapter/outboundgroup/http2ping/README.md +++ b/adapter/outboundgroup/http2ping/README.md @@ -70,6 +70,12 @@ tc qdisc add dev $interface parent 1:1 handle 2: netem delay $delay # remove tc rules tc qdisc del dev $interface root + +# drop output packets to ip +iptables -I OUTPUT -d $ip -j DROP + +# remove iptables rule +iptables -D OUTPUT 1 ``` ### cherrypick from old `http2ping` branch after 2023 Clash holocaust: diff --git a/adapter/outboundgroup/http2ping/pinger.go b/adapter/outboundgroup/http2ping/pinger.go index a81fd063..ee1dd134 100644 --- a/adapter/outboundgroup/http2ping/pinger.go +++ b/adapter/outboundgroup/http2ping/pinger.go @@ -4,6 +4,7 @@ import ( "context" "crypto/tls" "fmt" + "math" "sync/atomic" "time" @@ -67,7 +68,7 @@ func NewHTTP2Pinger(config *Config, proxy constant.Proxy) *http2Pinger { } func (p *http2Pinger) doPing(tlsConn *tls.Conn, http2Conn *http2.ClientConn) (uint32, error) { - tlsConn.SetDeadline(time.Now().Add(p.config.Interval * 5)) + tlsConn.SetDeadline(time.Now().Add(p.config.Interval)) defer tlsConn.SetDeadline(time.Time{}) start := time.Now() @@ -158,7 +159,7 @@ func (p *http2Pinger) pingLoop() { func (p *http2Pinger) GetSmoothRtt() uint32 { switch p.statusCode.Load() { case PINGER_STATUS_DEAD: - return 0 + return math.MaxUint32 case PINGER_STATUS_PINGING: fallthrough case PINGER_STATUS_IDLE: