Documentation
¶
Overview ¶
Xorlayer shows a uio layer stack with a plain TCP peer that does the same XOR by hand, so what each layer does is visible from both ends of the wire:
plain client server (uio)
net.Dial, XOR by hand handler: reads "hello", echoes it
│ ▲
│ layer 2 xor: ciphertext ⇄ plaintext
│ ▲
│ layer 1 wiretap: prints every byte
│ ▲
└────────────── wire ──────────────┘ socket
The first layer installed sits next to the socket, so the wiretap prints what actually crosses the wire — the XOR'd bytes — while the handler above the xor layer reads and writes plaintext. The echo travels back through both layers in reverse. A uio client installs the same stack with uio.WithLayers on its Dial; this example uses a plain peer so the wire is visible on both sides.
Run it:
go run ./xorlayer