Routing config: Replace processName with process (full-name/abs-path/abs-folder) (#5496)

About `self/` & `xray/`: https://github.com/XTLS/Xray-core/pull/5496#issuecomment-3714620380

Replaces https://github.com/XTLS/Xray-core/pull/5489
This commit is contained in:
风扇滑翔翼
2026-01-06 21:57:11 +08:00
committed by RPRX
parent d9025857fe
commit 446df149bd
9 changed files with 187 additions and 141 deletions
+4 -4
View File
@@ -21,22 +21,22 @@ const ChromeH2KeepAlivePeriod = 45 * time.Second
var ErrNotLocal = errors.New("the source address is not from local machine.")
type localIPCahceEntry struct {
type localIPCacheEntry struct {
addrs []net.Addr
lastUpdate time.Time
}
var localIPCahce = atomic.Pointer[localIPCahceEntry]{}
var localIPCache = atomic.Pointer[localIPCacheEntry]{}
func IsLocal(ip net.IP) (bool, error) {
var addrs []net.Addr
if entry := localIPCahce.Load(); entry == nil || time.Since(entry.lastUpdate) > time.Minute {
if entry := localIPCache.Load(); entry == nil || time.Since(entry.lastUpdate) > time.Minute {
var err error
addrs, err = net.InterfaceAddrs()
if err != nil {
return false, err
}
localIPCahce.Store(&localIPCahceEntry{
localIPCache.Store(&localIPCacheEntry{
addrs: addrs,
lastUpdate: time.Now(),
})