nntp_proxy/protocol/
mod.rs

1//! NNTP protocol handling module
2//!
3//! This module contains response parsing and protocol utilities for NNTP communication.
4
5use anyhow::Result;
6use std::net::SocketAddr;
7use tokio::io::AsyncWriteExt;
8use tokio::net::TcpStream;
9use tracing::debug;
10
11mod response;
12
13pub use response::ResponseParser;
14
15// Re-export for future use
16#[allow(unused_imports)]
17pub use response::NntpResponse;
18
19/// Send NNTP proxy greeting to a client
20///
21/// Sends the standard "200 NNTP Proxy Ready" greeting message.
22pub async fn send_proxy_greeting(
23    client_stream: &mut TcpStream,
24    client_addr: SocketAddr,
25) -> Result<()> {
26    let proxy_greeting = b"200 NNTP Proxy Ready\r\n";
27    client_stream.write_all(proxy_greeting).await?;
28    debug!("Sent proxy greeting to client {}", client_addr);
29    Ok(())
30}