Refactor checker logic to integrate context handling in MTProxy checks. Update error handling to utilize tgquick for response verification, replacing previous waitPostPayload function. Simplify error messages for closed connections.
Publish mtproxy_checker Docker image / test (push) Successful in 7s
Publish mtproxy_checker Docker image / build-and-push (push) Successful in 52s

This commit is contained in:
Denozordec
2026-04-11 01:44:53 +07:00
parent e3049028cd
commit 7d13c599c4
5 changed files with 287 additions and 46 deletions
+36
View File
@@ -0,0 +1,36 @@
package tgquick
import (
"encoding/binary"
"testing"
)
func TestPopRI_RoundTrip(t *testing.T) {
payload := []byte{1, 2, 3, 4, 5, 6, 7, 8}
enc, err := randomizedIntermediateEncode(payload)
if err != nil {
t.Fatal(err)
}
var acc []byte
acc = append(acc, enc...)
got, ok := popRI(&acc)
if !ok || len(acc) != 0 {
t.Fatalf("popRI: ok=%v rest=%d", ok, len(acc))
}
if string(got) != string(payload) {
t.Fatalf("payload mismatch: %v vs %v", got, payload)
}
}
func TestIsResPQ(t *testing.T) {
nonce := make([]byte, 16)
// resPQ: constructor + nonce(16) + server_nonce(16) + pq bytes + Vector<long>
msgData := make([]byte, 4+16+16+4+4)
binary.LittleEndian.PutUint32(msgData, tlResPQ)
copy(msgData[4:20], nonce)
copy(msgData[20:36], nonce)
// pq empty, fingerprints empty
if !isResPQ(wrapUnencrypted(msgData)) {
t.Fatal("expected resPQ")
}
}