Skip to content

Commit

Permalink
Update to axum-0.7/hyper-1.2
Browse files Browse the repository at this point in the history
Hyper (and by extension axum) remove the `Server` struct on 1.0, this
keeps the same API but uses axum::serve under the hood, with a slight
change to the Error type returned.
  • Loading branch information
RaoulHC committed Mar 24, 2024
1 parent 0c128c0 commit c00e230
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 111 deletions.
175 changes: 104 additions & 71 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matchbox_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ matchbox_protocol = { version = "0.9", path = "../matchbox_protocol", features =
"json",
] }
async-trait = "0.1"
axum = { version = "0.6", features = ["ws"] }
axum = { version = "0.7", features = ["ws"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tower-http = { version = "0.4", features = ["cors", "trace"] }
Expand Down
5 changes: 1 addition & 4 deletions matchbox_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ async fn main() {
})
.cors()
.trace()
.mutate_router(|router| {
// Apply router transformations
router.route("/health", get(|| async { StatusCode::OK }))
})
.mutate_router(|router| router.route("/health", get(health_handler)))
.build();
server
.serve()
Expand Down
6 changes: 3 additions & 3 deletions matchbox_signaling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ repository = "https://github.com/johanhelsing/matchbox"
matchbox_protocol = { version = "0.9", path = "../matchbox_protocol", features = [
"json",
] }
axum = { version = "0.6", features = ["ws"] }
hyper = { version = "0.14", features = ["server"] }
axum = { version = "0.7", features = ["ws"] }
hyper = { version = "1.2", features = ["server"] }
tracing = { version = "0.1", features = ["log"] }
tower-http = { version = "0.4", features = ["cors", "trace"] }
tower-http = { version = "0.5", features = ["cors", "trace"] }
tokio = { version = "1.32", features = ["macros", "rt-multi-thread"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
6 changes: 5 additions & 1 deletion matchbox_signaling/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ pub enum Error {

/// Couldn't bind to socket
#[error("Bind error: {0}")]
Bind(hyper::Error),
Bind(std::io::Error),

/// Error on serve
#[error("Serve error: {0}")]
Serve(std::io::Error),
}
Loading

0 comments on commit c00e230

Please sign in to comment.