]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cypherpunks.ru/nncp/pkt_test.go
Encrypt actual packet size, hide it
[nncp.git] / src / cypherpunks.ru / nncp / pkt_test.go
index 8ed0502aaeef07427386b290a9ff1e0b15f928c5..ec58785d298018edf2c3681a72a1e9c9ca08d039 100644 (file)
@@ -56,9 +56,6 @@ func TestPktEncWrite(t *testing.T) {
                if *pktEnc.Sender != *nodeOur.Id {
                        return false
                }
-               if pktEnc.Size != uint64(ct.Len()) {
-                       return false
-               }
                return true
        }
        if err := quick.Check(f, nil); err != nil {
@@ -75,7 +72,7 @@ func TestPktEncRead(t *testing.T) {
        if err != nil {
                panic(err)
        }
-       f := func(path string, pathSize uint8, data [1 << 16]byte, size uint16) bool {
+       f := func(path string, pathSize uint8, data [1 << 16]byte, size uint16, junk []byte) bool {
                dataR := bytes.NewReader(data[:])
                var ct bytes.Buffer
                if len(path) > int(pathSize) {
@@ -89,6 +86,7 @@ func TestPktEncRead(t *testing.T) {
                if err != nil {
                        return false
                }
+               ct.Write(junk)
                var pt bytes.Buffer
                nodes := make(map[NodeId]*Node)
                nodes[*node1.Id] = node1.Their()