Context: For certain reasons, we'd like to be able to obfuscate the DTLS version flag, but also need to support clients that do provide the flag. This PR allows the client to declare its version (allowing for "0", no flag) on the initial ClientHello packet. The version is stored in PeerData so the version is maintained for that respective connection.
Note 1: I left in the validation of the version flag to respect existing validation, but that may be unnecessary. I'd presume it is supposed to be there per spec.
Note 2: In general, I passed the protocol version value through the Encode method. Quite possibly could pass this in on the struct constructor as well - at the moment in my mind the two options feel somewhat equivalent overall? I'd be happy to change it though.
Context: For certain reasons, we'd like to be able to obfuscate the DTLS version flag, but also need to support clients that do provide the flag. This PR allows the client to declare its version (allowing for "0", no flag) on the initial
ClientHello
packet. The version is stored inPeerData
so the version is maintained for that respective connection.Note 1: I left in the validation of the version flag to respect existing validation, but that may be unnecessary. I'd presume it is supposed to be there per spec.
Note 2: In general, I passed the protocol version value through the Encode method. Quite possibly could pass this in on the struct constructor as well - at the moment in my mind the two options feel somewhat equivalent overall? I'd be happy to change it though.