pub fn version_negotiation(dcid: &[u8], scid: &[u8], versions: &[Version]) -> Vec<u8> {
        let mut encoder = Encoder::default();
        let mut grease = random(5);
        // This will not include the "QUIC bit" sometimes.  Intentionally.
        encoder.encode_byte(PACKET_BIT_LONG | (grease[4] & 0x7f));
        encoder.encode(&[0; 4]); // Zero version == VN.
        encoder.encode_vec(1, dcid);
        encoder.encode_vec(1, scid);

        for v in versions {
            encoder.encode_uint(4, v.as_u32());
        }
        // Add a greased version, using the randomness already generated.
        for g in &mut grease[..4] {
            *g = *g & 0xf0 | 0x0a;
        }
        encoder.encode(&grease[..4]);

        Vec::from(encoder)
    }
/// Make a Version Negotiation packet.
Make a Version Negotiation packet.
Make a Version Negotiation packet .
pub fn version_negotiation(dcid: &[u8], scid: &[u8], versions: &[Version]) -> Vec<u8> {
        let mut encoder = Encoder::default();
        let mut grease = random(5);
        // This will not include the "QUIC bit" sometimes.  Intentionally.
        encoder.encode_byte(PACKET_BIT_LONG | (grease[4] & 0x7f));
        encoder.encode(&[0; 4]); // Zero version == VN.
        encoder.encode_vec(1, dcid);
        encoder.encode_vec(1, scid);
        for v in versions {
            encoder.encode_uint(4, v.as_u32());
        }
        // Add a greased version, using the randomness already generated.
        for g in &mut grease[..4] {
            *g = *g & 0xf0 | 0x0a;
        }
        encoder.encode(&grease[..4]);
        Vec::from(encoder)
    }
pub fn version_negotiation ( dcid : & [ u8 ] , scid : & [ u8 ] , versions : & [ Version ] ) -> Vec < u8 > { let mut encoder = Encoder :: default ( ) ; let mut grease = random ( 5 ) ; // This will not include the "QUIC bit" sometimes.  Intentionally. encoder . encode_byte ( PACKET_BIT_LONG | ( grease [ 4 ] & 0x7f ) ) ; encoder . encode ( & [ 0 ; 4 ] ) ; // Zero version == VN. encoder . encode_vec ( 1 , dcid ) ; encoder . encode_vec ( 1 , scid ) ; for v in versions { encoder . encode_uint ( 4 , v . as_u32 ( ) ) ; } // Add a greased version, using the randomness already generated. for g in & mut grease [ .. 4 ] { * g = * g & 0xf0 | 0x0a ; } encoder . encode ( & grease [ .. 4 ] ) ; Vec :: from ( encoder ) }
Make a Version Negotiation packet.
Make a Version Negotiation packet .
dcid
&[u8]
scid
&[u8]
versions
&[Version]