Created
October 25, 2021 01:35
-
-
Save Shirataki2/b64f14314509f9e6634cf896beb00d68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use pnet_macros::Packet; | |
use pnet_macros_support::{packet::Packet, types::*}; | |
#[derive(Packet)] | |
pub struct SpeakingStart { | |
length: u13le, | |
ty: u3, | |
snowflake: u64le, | |
timestamp: u64le, | |
#[payload] | |
payload: Vec<u8>, | |
} | |
#[derive(Packet)] | |
pub struct Voice { | |
length: u13le, | |
ty: u3, | |
snowflake: u64le, | |
sequence: u16le, | |
#[payload] | |
data: Vec<u8>, | |
} | |
fn main() { | |
let mut data = vec![0xa7; 32]; | |
let mut packet = MutableVoicePacket::new(&mut data[..]).unwrap(); | |
println!("{:?}", packet); | |
println!("{:?}", packet.packet()); | |
packet.set_snowflake(0x123456789abcdef0); | |
println!("{:?}", packet); | |
println!("{:?}", packet.packet()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MutableVoicePacket { length : 679, ty : 7, snowflake : 12080808863958804391, sequence : 42919, } | |
[167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167] | |
MutableVoicePacket { length : 679, ty : 7, snowflake : 1311768467463790320, sequence : 42919, } | |
[167, 167, 240, 222, 188, 154, 120, 86, 52, 18, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment