TUN inbound: Consolidate files and remove unneeded tests; Rename wfp_leak.go to wfp_block.go (#7482)

https://github.com/XTLS/Xray-core/pull/7460#issuecomment-7131171930

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patterniha
2026-11-25 12:29:26 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 35805f9377
commit 862e59a2f2
16 changed files with 743 additions and 979 deletions
+16
View File
@@ -5,6 +5,7 @@ import (
"net"
"sync"
"github.com/google/uuid"
"github.com/xtls/xray-core/common/errors"
)
@@ -49,3 +50,18 @@ func (updater *InterfaceUpdater) Update() {
updater.iface = got
errors.LogInfo(context.Background(), "[tun] update interface ", got.Name, " ", got.Index)
}
// ParseGUID parses a canonical textual GUID, as in
// "00000000-0000-0000-0000-000000000000", into the 16 bytes it denotes.
// The form is all that is accepted, not the other ones uuid.Parse takes,
// such as one without hyphens; the length check is what rules those out.
func ParseGUID(s string) ([16]byte, error) {
if len(s) != 36 {
return [16]byte{}, errors.New("invalid guid: ", s, ", want xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
}
id, err := uuid.Parse(s)
if err != nil {
return [16]byte{}, errors.New("invalid guid: ", s, ", want xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").Base(err)
}
return id, nil
}