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

Support optionally-enabled middleware #11

Open
dylanmckay opened this issue Jul 26, 2018 · 0 comments
Open

Support optionally-enabled middleware #11

dylanmckay opened this issue Jul 26, 2018 · 0 comments

Comments

@dylanmckay
Copy link
Owner

dylanmckay commented Jul 26, 2018

We could add impl Middleware for Option<M: Middleware>.

Then piplines could be done line so

struct Pipeline {
     encryption: Option<Encryption>,
     compression: Option<Compression>,
}

fn handle(packet: _, pipeline: &mut Pipeline) {
    match packet {
        LoginSuccess => {
            pipeline.encryption = Some(Encryption::new(..));
        },
    }
}

This would be required for protocols such as minecraft, which optionally enables encryption at login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant