Files
Denozordec 4905c06b9b
Publish mtproxy_checker Docker image / test (push) Successful in 19s
Publish mtproxy_checker Docker image / build-and-push (push) Successful in 48s
init
2026-04-11 00:38:22 +07:00

26 lines
551 B
Go

package faketls
import (
"io"
)
// WriteTLSApplicationData wraps payload in TLS 1.2 application records (type 0x17).
func WriteTLSApplicationData(w io.Writer, p []byte) error {
const maxChunk = 16384
for off := 0; off < len(p); off += maxChunk {
end := off + maxChunk
if end > len(p) {
end = len(p)
}
chunk := p[off:end]
hdr := []byte{0x17, 0x03, 0x03, byte(len(chunk) >> 8), byte(len(chunk))}
if _, err := w.Write(hdr); err != nil {
return err
}
if _, err := w.Write(chunk); err != nil {
return err
}
}
return nil
}