Skip to content

Commit

Permalink
strong type ipv4 addr
Browse files Browse the repository at this point in the history
Signed-off-by: remzi <[email protected]>
  • Loading branch information
HaoYang670 committed May 30, 2024
1 parent 9b27f40 commit 2d1d5f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rucat_server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::net::{Ipv4Addr, SocketAddrV4};

use rucat_common::error::Result;
use rucat_server::get_server;
use tracing::info;
Expand All @@ -7,11 +9,12 @@ use tracing::info;
async fn main() -> Result<()> {
// setup tracing
tracing_subscriber::fmt::init();
static ENDPOINT: &str = "127.0.0.1:3000";

let endpoint = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 3000);
let app = get_server(true).await?;

// run it
let listener = tokio::net::TcpListener::bind(ENDPOINT).await?;
let listener = tokio::net::TcpListener::bind(endpoint).await?;
info!("Rucat server is listening on {}", listener.local_addr()?);
axum::serve(listener, app).await?;
Ok(())
Expand Down

0 comments on commit 2d1d5f8

Please sign in to comment.