Skip to content

Commit a2b55dd

Browse files
committed
api: fix missing /ports/interfaces endpoint
1 parent f0fa43a commit a2b55dd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

taxy/src/admin/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ pub async fn start_admin(
142142
.route("/{id}/status", get(ports::status))
143143
.route("/{id}", put(ports::put))
144144
.route("/{id}", delete(ports::delete))
145-
.route("/{id}/reset", get(ports::reset));
145+
.route("/{id}/reset", get(ports::reset))
146+
.route("/interfaces", get(ports::interfaces));
146147

147148
let proxies_routes = Router::new()
148149
.route("/", get(proxies::list))

taxy/src/admin/ports.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
use super::{AppError, AppState};
22
use crate::server::rpc::ports::{
3-
AddPort, DeletePort, GetPort, GetPortList, GetPortStatus, ResetPort, UpdatePort,
3+
AddPort, DeletePort, GetNetworkInterfaceList, GetPort, GetPortList, GetPortStatus, ResetPort,
4+
UpdatePort,
45
};
56
use axum::{
67
extract::{Path, State},
78
Json,
89
};
910
use taxy_api::{
1011
id::ShortId,
11-
port::{Port, PortEntry, PortStatus},
12+
port::{NetworkInterface, Port, PortEntry, PortStatus},
1213
};
1314

1415
pub async fn list(State(state): State<AppState>) -> Result<Json<Box<Vec<PortEntry>>>, AppError> {
@@ -58,3 +59,9 @@ pub async fn reset(
5859
) -> Result<Json<Box<()>>, AppError> {
5960
Ok(Json(state.call(ResetPort { id }).await?))
6061
}
62+
63+
pub async fn interfaces(
64+
State(state): State<AppState>,
65+
) -> Result<Json<Box<Vec<NetworkInterface>>>, AppError> {
66+
Ok(Json(state.call(GetNetworkInterfaceList).await?))
67+
}

0 commit comments

Comments
 (0)