mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 16:14:02 +03:00
Set random length of the tls packets
This commit is contained in:
@@ -3,6 +3,7 @@ package faketls
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/9seconds/mtg/v2/mtglib/internal/faketls/record"
|
"github.com/9seconds/mtg/v2/mtglib/internal/faketls/record"
|
||||||
@@ -50,8 +51,8 @@ func (c *Conn) Write(p []byte) (int, error) {
|
|||||||
written := 0
|
written := 0
|
||||||
|
|
||||||
for len(p) > 0 {
|
for len(p) > 0 {
|
||||||
chunkSize := record.TLSMaxRecordSize
|
chunkSize := rand.Intn(record.TLSMaxRecordSize)
|
||||||
if chunkSize > len(p) {
|
if chunkSize > len(p) || chunkSize == 0 {
|
||||||
chunkSize = len(p)
|
chunkSize = len(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user