1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-04 16:37:12 -05:00
This commit is contained in:
Darien Raymond 2017-04-27 11:54:15 +02:00
parent b841042d0c
commit 2e756cdaa8
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
7 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ func (v *UDPNameServer) AssignUnusedID(response chan<- *ARecord) uint16 {
} }
for { for {
id = dice.RandomUint16() id = dice.RollUint16()
if _, found := v.requests[id]; found { if _, found := v.requests[id]; found {
continue continue
} }

View File

@ -15,8 +15,8 @@ func Roll(n int) int {
return rand.Intn(n) return rand.Intn(n)
} }
// RandomUint16 returns a random uint16 value. // RollUint16 returns a random uint16 value.
func RandomUint16() uint16 { func RollUint16() uint16 {
return uint16(rand.Intn(65536)) return uint16(rand.Intn(65536))
} }

View File

@ -28,7 +28,7 @@ func (s *SRTP) Write(b []byte) (int, error) {
func NewSRTP(ctx context.Context, config interface{}) (interface{}, error) { func NewSRTP(ctx context.Context, config interface{}) (interface{}, error) {
return &SRTP{ return &SRTP{
header: 0xB5E8, header: 0xB5E8,
number: dice.RandomUint16(), number: dice.RollUint16(),
}, nil }, nil
} }

View File

@ -31,7 +31,7 @@ func NewUTP(ctx context.Context, config interface{}) (interface{}, error) {
return &UTP{ return &UTP{
header: 1, header: 1,
extension: 0, extension: 0,
connectionId: dice.RandomUint16(), connectionId: dice.RollUint16(),
}, nil }, nil
} }

View File

@ -27,7 +27,7 @@ func (vc *VideoChat) Write(b []byte) (int, error) {
func NewVideoChat(ctx context.Context, config interface{}) (interface{}, error) { func NewVideoChat(ctx context.Context, config interface{}) (interface{}, error) {
return &VideoChat{ return &VideoChat{
sn: int(dice.RandomUint16()), sn: int(dice.RollUint16()),
}, nil }, nil
} }

View File

@ -18,7 +18,7 @@ import (
) )
var ( var (
globalConv = uint32(dice.RandomUint16()) globalConv = uint32(dice.RollUint16())
) )
type ClientConnection struct { type ClientConnection struct {

View File

@ -20,7 +20,7 @@ import (
func TestV2RayClose(t *testing.T) { func TestV2RayClose(t *testing.T) {
assert := assert.On(t) assert := assert.On(t)
port := v2net.Port(dice.RandomUint16()) port := v2net.Port(dice.RollUint16())
config := &Config{ config := &Config{
Inbound: []*proxyman.InboundHandlerConfig{ Inbound: []*proxyman.InboundHandlerConfig{
{ {