Release 3.8.1.1: lighter idle UI poll, core cache, multicore ping.
Reduce idle CPU (cheap PollUI, binary cache, logbuf cap, DOM fingerprint), speed ping/AWG HostPort, CopyBuffer pool; ship arm64 build and update notes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -44,7 +45,14 @@ func PingAll(ctx context.Context, targets []Target) []Result {
|
||||
if len(targets) == 0 {
|
||||
return out
|
||||
}
|
||||
workers := 12
|
||||
// Scale with available OS threads (GOMAXPROCS); keep a useful floor/ceiling.
|
||||
workers := runtime.GOMAXPROCS(0) * 2
|
||||
if workers < 8 {
|
||||
workers = 8
|
||||
}
|
||||
if workers > 32 {
|
||||
workers = 32
|
||||
}
|
||||
if len(targets) < workers {
|
||||
workers = len(targets)
|
||||
}
|
||||
@@ -99,7 +107,8 @@ func BestOK(results []Result) (Result, bool) {
|
||||
}
|
||||
|
||||
// PingProfile pings using protocol hints when available.
|
||||
// Naive uses TCP; Hysteria 2 uses UDP (QUIC) — TCP would always look "refused".
|
||||
// Naive uses TCP; Hysteria 2 / AWG use UDP — TCP would always look "refused".
|
||||
// When proto is set, Detect is skipped (trust stored protocol).
|
||||
func PingProfile(ctx context.Context, name string, proto config.Protocol, proxyURI string) Result {
|
||||
res := Result{Name: name}
|
||||
if strings.TrimSpace(proxyURI) == "" {
|
||||
@@ -107,9 +116,22 @@ func PingProfile(ctx context.Context, name string, proto config.Protocol, proxyU
|
||||
return res
|
||||
}
|
||||
|
||||
hy2 := proto == config.ProtocolHysteria2 || hysteria2.Detect(proxyURI)
|
||||
isAWG := proto == config.ProtocolAWG || awg.Detect(proxyURI)
|
||||
isXray := proto == config.ProtocolVLESS || proto == config.ProtocolVMess || proto == config.ProtocolTrojan || xray.Detect(proxyURI)
|
||||
var hy2, isAWG, isXray bool
|
||||
switch proto {
|
||||
case config.ProtocolHysteria2:
|
||||
hy2 = true
|
||||
case config.ProtocolAWG:
|
||||
isAWG = true
|
||||
case config.ProtocolVLESS, config.ProtocolVMess, config.ProtocolTrojan:
|
||||
isXray = true
|
||||
case config.ProtocolNaive:
|
||||
// TCP host parse below
|
||||
default:
|
||||
hy2 = hysteria2.Detect(proxyURI)
|
||||
isAWG = awg.Detect(proxyURI)
|
||||
isXray = xray.Detect(proxyURI)
|
||||
}
|
||||
|
||||
var host, port string
|
||||
if isAWG {
|
||||
h, p, err := awg.HostPort(proxyURI)
|
||||
|
||||
Reference in New Issue
Block a user