Closed bassosimone closed 2 years ago
use math's package constants to express limits;
distinguish between options encoding and decoding errors;
use longer variable names when I thought the variable names were too short and hence not descriptive enough;
ensure functions defined in vpn/bytes.go mention "bytes" in their name to provide readers of a clue of where they belong;
decodeOptionStringFromBytes: avoid panic when byte array length is smaller than two bytes;
decodeOptionStringFromBytes: reslice to simplify arithmetics;
decodeOptionStringFromBytes: handle case where the peer sends a zero length encoding of options;
decodeOptionStringFromBytes: handle case where \0 is missing;
introduce panicIfFalse to emulate assert in golang, except that panicIfFalse is better because it cannot be disabled.
assert
Part of https://github.com/ooni/probe/issues/2083
Oh, tests are broken. Let me see if I can fix them.
Ah, okay, it was already fixed in master, so I merged with master.
Thank you!
use math's package constants to express limits;
distinguish between options encoding and decoding errors;
use longer variable names when I thought the variable names were too short and hence not descriptive enough;
ensure functions defined in vpn/bytes.go mention "bytes" in their name to provide readers of a clue of where they belong;
decodeOptionStringFromBytes: avoid panic when byte array length is smaller than two bytes;
decodeOptionStringFromBytes: reslice to simplify arithmetics;
decodeOptionStringFromBytes: handle case where the peer sends a zero length encoding of options;
decodeOptionStringFromBytes: handle case where \0 is missing;
introduce panicIfFalse to emulate
assert
in golang, except that panicIfFalse is better because it cannot be disabled.Part of https://github.com/ooni/probe/issues/2083