mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-13 22:45:13 +00:00
dice.RandomUint16
This commit is contained in:
7 files changed
+13
-8
No files matched your search
@@ -2,9 +2,9 @@ package srtp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/rand"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/dice"
|
||||
"v2ray.com/core/common/serial"
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ func (v *SRTP) Write(b []byte) (int, error) {
|
||||
func NewSRTP(ctx context.Context, config interface{}) (interface{}, error) {
|
||||
return &SRTP{
|
||||
header: 0xB5E8,
|
||||
number: uint16(rand.Intn(65536)),
|
||||
number: dice.RandomUint16(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package utp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/rand"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/dice"
|
||||
"v2ray.com/core/common/serial"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func NewUTP(ctx context.Context, config interface{}) (interface{}, error) {
|
||||
return &UTP{
|
||||
header: 1,
|
||||
extension: 0,
|
||||
connectionId: uint16(rand.Intn(65536)),
|
||||
connectionId: dice.RandomUint16(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ func (vc *VideoChat) Write(b []byte) (int, error) {
|
||||
|
||||
func NewVideoChat(ctx context.Context, config interface{}) (interface{}, error) {
|
||||
return &VideoChat{
|
||||
sn: dice.Roll(65535),
|
||||
sn: int(dice.RandomUint16()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
globalConv = uint32(dice.Roll(65536))
|
||||
globalConv = uint32(dice.RandomUint16())
|
||||
globalPool = internal.NewConnectionPool()
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user