initial commit

This commit is contained in:
2026-02-22 20:58:47 +07:00
parent 89b3037556
commit bf7d50bcef
61 changed files with 3840 additions and 0 deletions
@@ -0,0 +1,40 @@
use async_trait::async_trait;
use tokio::net::{
tcp::{OwnedReadHalf, OwnedWriteHalf},
TcpStream,
};
use crate::{
protocol::codec::codec::Codec,
proxy::connection::{buf_pair::BufPair, state::ConnectionState},
};
#[async_trait]
pub trait ProxyHandler {
async fn do_new(
&self,
reader: &mut OwnedReadHalf,
writer: &mut OwnedWriteHalf,
buffers: &mut BufPair,
) -> Result<ConnectionState, String>;
async fn do_handshake(
&self,
reader: &mut OwnedReadHalf,
writer: &mut OwnedWriteHalf,
buffers: &mut BufPair,
codec: &mut Codec,
) -> Result<ConnectionState, String>;
async fn do_tunnel(
&self,
reader: &mut OwnedReadHalf,
writer: &mut OwnedWriteHalf,
buffers: &mut BufPair,
codec: &mut Codec,
target: &mut TcpStream,
) -> Result<ConnectionState, String>;
async fn do_close(
&self,
reader: &mut OwnedReadHalf,
writer: &mut OwnedWriteHalf,
buffers: &mut BufPair,
) -> Result<ConnectionState, String>;
}