cat / goq
clone

turns a linux box into a private steam streaming appliance: plug in, tap your key, play from another computer

fix/architecture-review-findings
goq / src-tauri / src / commands / network.rs
network.rs 2.7K
1use super::state::AppState;2pub use crate::media::adaptive_feedback::ClientMediaFeedbackReport;3use crate::media::adaptive_feedback::send_media_feedback;4use crate::media::audio_delivery;5pub use crate::media::connect::ConnectResult;6use crate::media::connect::{connect_client, disconnect_client};7use crate::media::frame_channel::acknowledge_frame_delivery;8use crate::media::input_delivery::PointerFeedbackPayload;9use crate::media::input_delivery::send_input;10use crate::media::media_control::request_keyframe;11use sigil_protocol::InputEvent;12use tauri::{13 AppHandle, State,14 ipc::{Channel, Response},15};1617// ─── Client commands ──────────────────────────────────────────────────────────1819#[tauri::command]20pub async fn iroh_client_connect(21 app: AppHandle,22 state: State<'_, AppState>,23 pin: String,24 frame_channel: Channel<Response>,25 audio_channel: Channel<Response>,26 pointer_channel: Channel<PointerFeedbackPayload>,27 audio_supported: bool,28) -> Result<ConnectResult, String> {29 connect_client(30 app,31 &state,32 pin,33 frame_channel,34 audio_channel,35 pointer_channel,36 audio_supported,37 )38 .await39}4041#[tauri::command]42pub async fn iroh_client_send_input(43 state: State<'_, AppState>,44 event: InputEvent,45) -> Result<bool, String> {46 send_input(&state, event).await47}4849#[tauri::command]50pub async fn iroh_client_request_keyframe(51 state: State<'_, AppState>,52 generation: u64,53 reason: String,54) -> Result<bool, String> {55 request_keyframe(&state, generation, reason).await56}5758#[tauri::command]59pub async fn iroh_client_send_media_feedback(60 state: State<'_, AppState>,61 generation: u64,62 report: ClientMediaFeedbackReport,63) -> Result<bool, String> {64 send_media_feedback(&state, generation, report).await65}6667#[tauri::command]68pub async fn iroh_client_ack_frame(69 state: State<'_, AppState>,70 generation: u64,71) -> Result<bool, String> {72 acknowledge_frame_delivery(&state, generation).await73}7475#[tauri::command]76pub fn iroh_client_ack_audio(77 state: State<'_, AppState>,78 generation: u64,79 delivery_id: u64,80) -> Result<bool, String> {81 audio_delivery::iroh_client_ack_audio(state, generation, delivery_id)82}8384#[tauri::command]85pub async fn iroh_client_stop_audio(86 state: State<'_, AppState>,87 expected_generation: u64,88) -> Result<bool, String> {89 audio_delivery::iroh_client_stop_audio(state, expected_generation).await90}9192#[tauri::command]93pub async fn iroh_client_disconnect(state: State<'_, AppState>) -> Result<bool, String> {94 disconnect_client(&state).await95}