1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 15:36:41 -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 {
id = dice.RandomUint16()
id = dice.RollUint16()
if _, found := v.requests[id]; found {
continue
}

View File

@ -15,8 +15,8 @@ func Roll(n int) int {
return rand.Intn(n)
}
// RandomUint16 returns a random uint16 value.
func RandomUint16() uint16 {
// RollUint16 returns a random uint16 value.
func RollUint16() uint16 {
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) {
return &SRTP{
header: 0xB5E8,
number: dice.RandomUint16(),
number: dice.RollUint16(),
}, nil
}

View File

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

View File

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

View File

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

View File

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