chore: Generate UUID from fastrand

This commit is contained in:
H1JK
2023-03-05 11:00:14 +08:00
parent 3b037acb01
commit ae966833a4
11 changed files with 34 additions and 19 deletions

View File

@ -1,6 +1,7 @@
package context
import (
"github.com/Dreamacro/clash/common/utils"
"net"
N "github.com/Dreamacro/clash/common/net"
@ -16,7 +17,7 @@ type ConnContext struct {
}
func NewConnContext(conn net.Conn, metadata *C.Metadata) *ConnContext {
id, _ := uuid.NewV4()
id, _ := utils.UnsafeUUIDGenerator.NewV4()
return &ConnContext{
id: id,

View File

@ -2,6 +2,7 @@ package context
import (
"context"
"github.com/Dreamacro/clash/common/utils"
"github.com/gofrs/uuid"
"github.com/miekg/dns"
@ -22,7 +23,7 @@ type DNSContext struct {
}
func NewDNSContext(ctx context.Context, msg *dns.Msg) *DNSContext {
id, _ := uuid.NewV4()
id, _ := utils.UnsafeUUIDGenerator.NewV4()
return &DNSContext{
Context: ctx,

View File

@ -3,6 +3,7 @@ package context
import (
"net"
"github.com/Dreamacro/clash/common/utils"
C "github.com/Dreamacro/clash/constant"
"github.com/gofrs/uuid"
@ -15,7 +16,7 @@ type PacketConnContext struct {
}
func NewPacketConnContext(metadata *C.Metadata) *PacketConnContext {
id, _ := uuid.NewV4()
id, _ := utils.UnsafeUUIDGenerator.NewV4()
return &PacketConnContext{
id: id,
metadata: metadata,