mirror of https://github.com/v2ray/v2ray-core
				
				
				
			refactor
							parent
							
								
									b841042d0c
								
							
						
					
					
						commit
						2e756cdaa8
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	globalConv = uint32(dice.RandomUint16())
 | 
			
		||||
	globalConv = uint32(dice.RollUint16())
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type ClientConnection struct {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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{
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue