mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-22 06:49:08 +00:00
Remove file that should not have been committed
This commit is contained in:
parent
ad72147ff4
commit
fb28783598
1 changed files with 0 additions and 50 deletions
|
@ -1,50 +0,0 @@
|
|||
use std::collections::VecDeque;
|
||||
use std::io::{Read, Write};
|
||||
use mio::net::TcpStream;
|
||||
use crate::error::Error;
|
||||
|
||||
struct Stream {
|
||||
write_buf: VecDeque<u8>,
|
||||
}
|
||||
|
||||
impl Stream {
|
||||
pub fn writable_bytes(&self) -> usize {
|
||||
return self.write_buf.len();
|
||||
}
|
||||
|
||||
pub fn read_data(&mut self, data: &[u8]) {
|
||||
|
||||
}
|
||||
|
||||
pub fn forward(&mut self, tcp_stream: &mut TcpStream) {
|
||||
//tcp_stream.write()
|
||||
}
|
||||
|
||||
/*pub fn read(&mut self, tcp_socket: &mut smoltcp::socket::Socket::Tcp) {
|
||||
//tcp_socket.read()
|
||||
}*/
|
||||
}
|
||||
|
||||
struct DnsProxy {
|
||||
query: Vec<u8>,
|
||||
response: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl DnsProxy {
|
||||
pub fn receive_query(payload: &[u8]) -> Result<Self, Error> {
|
||||
if payload.len() > 0xffff {
|
||||
return Err("DNS payload too large".into());
|
||||
}
|
||||
Ok(Self {
|
||||
query: Vec::from(payload),
|
||||
response: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_response(&self) -> Result<Option<&[u8]>, Error> {
|
||||
Ok(match &self.response {
|
||||
None => None,
|
||||
Some(bytes) => Some(bytes.as_slice())
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue