fix uuid match

This commit is contained in:
wwqgtxx 2022-05-06 13:08:27 +08:00
parent b3295262c1
commit a08e39faec

View file

@ -7,10 +7,11 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"net" "net"
"regexp"
"github.com/Dreamacro/clash/component/dialer" "github.com/Dreamacro/clash/component/dialer"
C "github.com/Dreamacro/clash/constant" C "github.com/Dreamacro/clash/constant"
"github.com/gofrs/uuid"
) )
type Base struct { type Base struct {
@ -151,8 +152,8 @@ func newPacketConn(pc net.PacketConn, a C.ProxyAdapter) C.PacketConn {
} }
func uuidMap(str string) string { func uuidMap(str string) string {
match, _ := regexp.MatchString(`[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}$`, str) _, err := uuid.FromString(str)
if !match { if err != nil {
var Nil [16]byte var Nil [16]byte
h := sha1.New() h := sha1.New()
h.Write(Nil[:]) h.Write(Nil[:])