Skip to content

Commit 38e538c

Browse files
committed
fix: untyped int constant overflows
1 parent 9a21d98 commit 38e538c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

speedtest/transport/udp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818

1919
type PacketLossSender struct {
2020
ID string // UUID
21-
nounce int // Random int (maybe) [0,10000000000)
21+
nounce int64 // Random int (maybe) [0,10000000000)
2222
withTimestamp bool // With timestamp (ten seconds level)
2323
conn net.Conn // UDP Conn
2424
raw []byte
@@ -28,7 +28,7 @@ type PacketLossSender struct {
2828

2929
func NewPacketLossSender(uuid string, dialer *net.Dialer) (*PacketLossSender, error) {
3030
rd := mrand.New(mrand.NewSource(time.Now().UnixNano()))
31-
nounce := rd.Intn(10000000000)
31+
nounce := rd.Int63n(10000000000)
3232
p := &PacketLossSender{
3333
ID: strings.ToUpper(uuid),
3434
nounce: nounce,

0 commit comments

Comments
 (0)