diff --git a/tuic-client/src/connection.rs b/tuic-client/src/connection.rs index 7d14e8c..84bf348 100644 --- a/tuic-client/src/connection.rs +++ b/tuic-client/src/connection.rs @@ -251,7 +251,7 @@ impl Connection { } async fn authenticate(self) { - match self.model.authenticate([0; 8]).await { + match self.model.authenticate([0; 32]).await { Ok(()) => {} Err(err) => eprintln!("{err}"), } diff --git a/tuic-quinn/src/lib.rs b/tuic-quinn/src/lib.rs index 8c94025..29057ba 100644 --- a/tuic-quinn/src/lib.rs +++ b/tuic-quinn/src/lib.rs @@ -102,7 +102,7 @@ impl Connection { } } - pub async fn authenticate(&self, token: [u8; 8]) -> Result<(), Error> { + pub async fn authenticate(&self, token: [u8; 32]) -> Result<(), Error> { let model = self.model.send_authenticate(token); let mut send = self.conn.open_uni().await?; model.header().async_marshal(&mut send).await?; @@ -388,7 +388,7 @@ impl Packet { #[non_exhaustive] pub enum Task { - Authenticate([u8; 8]), + Authenticate([u8; 32]), Connect(Connect), Packet(Packet), Dissociate(u16), diff --git a/tuic/src/model/authenticate.rs b/tuic/src/model/authenticate.rs index e02940d..9dcb965 100644 --- a/tuic/src/model/authenticate.rs +++ b/tuic/src/model/authenticate.rs @@ -11,7 +11,7 @@ pub struct Tx { } impl Authenticate { - pub(super) fn new(token: [u8; 8]) -> Self { + pub(super) fn new(token: [u8; 32]) -> Self { Self { inner: Side::Tx(Tx { header: Header::Authenticate(AuthenticateHeader::new(token)), @@ -27,18 +27,18 @@ impl Authenticate { } pub struct Rx { - token: [u8; 8], + token: [u8; 32], } impl Authenticate { - pub(super) fn new(token: [u8; 8]) -> Self { + pub(super) fn new(token: [u8; 32]) -> Self { Self { inner: Side::Rx(Rx { token }), _marker: side::Rx, } } - pub fn token(&self) -> [u8; 8] { + pub fn token(&self) -> [u8; 32] { let Side::Rx(rx) = &self.inner else { unreachable!() }; rx.token } diff --git a/tuic/src/model/mod.rs b/tuic/src/model/mod.rs index 5ce3c71..9e66fe1 100644 --- a/tuic/src/model/mod.rs +++ b/tuic/src/model/mod.rs @@ -50,7 +50,7 @@ where } } - pub fn send_authenticate(&self, token: [u8; 8]) -> Authenticate { + pub fn send_authenticate(&self, token: [u8; 32]) -> Authenticate { Authenticate::::new(token) } diff --git a/tuic/src/protocol/authenticate.rs b/tuic/src/protocol/authenticate.rs index b17f791..9879241 100644 --- a/tuic/src/protocol/authenticate.rs +++ b/tuic/src/protocol/authenticate.rs @@ -1,21 +1,21 @@ // +-------+ // | TOKEN | // +-------+ -// | 8 | +// | 32 | // +-------+ #[derive(Clone, Debug)] pub struct Authenticate { - token: [u8; 8], + token: [u8; 32], } impl Authenticate { const TYPE_CODE: u8 = 0x00; - pub const fn new(token: [u8; 8]) -> Self { + pub const fn new(token: [u8; 32]) -> Self { Self { token } } - pub fn token(&self) -> [u8; 8] { + pub fn token(&self) -> [u8; 32] { self.token } @@ -24,11 +24,11 @@ impl Authenticate { } pub fn len(&self) -> usize { - 8 + 32 } } -impl From for ([u8; 8],) { +impl From for ([u8; 32],) { fn from(auth: Authenticate) -> Self { (auth.token,) } diff --git a/tuic/src/unmarshal.rs b/tuic/src/unmarshal.rs index 7b4b48a..ca037c2 100644 --- a/tuic/src/unmarshal.rs +++ b/tuic/src/unmarshal.rs @@ -164,14 +164,14 @@ impl Address { impl Authenticate { #[cfg(feature = "async_marshal")] async fn async_read(s: &mut (impl AsyncRead + Unpin)) -> Result { - let mut buf = [0; 8]; + let mut buf = [0; 32]; s.read_exact(&mut buf).await?; Ok(Self::new(buf)) } #[cfg(feature = "marshal")] fn read(s: &mut impl Read) -> Result { - let mut buf = [0; 8]; + let mut buf = [0; 32]; s.read_exact(&mut buf)?; Ok(Self::new(buf)) }