Skip to content

Support optionally-enabled middleware #11

Description

@dylanmckay

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions