Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Framing crate #969

Closed

Commits on Jun 18, 2024

  1. Refactor header.rs

    1. Removed `NoiseHeader` struct in favor of three constants defined at
    the top of the file.
    2. Added documentation and changed visibility to `pub(crate)` where
    needed.
    3. Removed `Header::Default` and `Sv2Frame::Default` impls as they are
    unused.
    4. Removed `unwrap()`s
    jbesraa committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    bf33c5a View commit details
    Browse the repository at this point in the history
  2. Remove Frame trait

    The `Frame` trait is used solely by a single struct and its only adding
    biolerplate to the code without benifits. We could consider re-adding it
    in the future if needed.
    jbesraa committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    0caa106 View commit details
    Browse the repository at this point in the history
  3. Refactor Framing crate

    This commit aims to refactor the `framing-sv2` crate. List of changes:
    1. Removed `Frame` trait
    2. Changed `EitherFrame` enum to `Frame`
    3. Removed unused functions from `HandShakeFrame` and `Sv2Frame`
    4. Added documentation where missing
    5. Made sure there is consistency in function naming in `Frame`, i.e, in
       order to get the header you call `Frame::header`, for payload
       `Frame::payload` and so on.
    6. Made sure we dont return mut data from `Frame` get functions(leave it
       to the caller to decide).
    7. Fixed all the modules in `protocols` based on the above changes
    8. Fixed all the modules in `roles` based on the above changes
    
    For 7 & 8 its mainly removing the `Frame` trait import plus naming fixes
    where I renamed `StandardEitherFrame` to `StandardFrame` and other name
    fixes and also fixing the `header` and `payload` calls to align with the
    new API.
    jbesraa committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    12bec35 View commit details
    Browse the repository at this point in the history