mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-24 07:46:03 +00:00
Merge branch 'master' into v8
This commit is contained in:
commit
641363e0bc
1 changed files with 7 additions and 6 deletions
|
@ -178,7 +178,7 @@ struct TcpConnectState {
|
|||
close_state: u8,
|
||||
wait_read: bool,
|
||||
wait_write: bool,
|
||||
expiry: Option<::std::time::Instant>,
|
||||
udp_acco_expiry: Option<::std::time::Instant>,
|
||||
udp_socket: Option<UdpSocket>,
|
||||
udp_token: Option<Token>,
|
||||
udp_origin_dst: Option<SocketAddr>,
|
||||
|
@ -532,8 +532,8 @@ impl<'a> TunToProxy<'a> {
|
|||
|
||||
let err = "udp associate state not find";
|
||||
let state = self.connection_map.get_mut(info).ok_or(err)?;
|
||||
assert!(state.expiry.is_some());
|
||||
state.expiry = Some(Self::udp_associate_timeout());
|
||||
assert!(state.udp_acco_expiry.is_some());
|
||||
state.udp_acco_expiry = Some(Self::udp_associate_timeout());
|
||||
|
||||
// Add SOCKS5 UDP header to the incoming data
|
||||
let mut s5_udp_data = Vec::<u8>::new();
|
||||
|
@ -661,7 +661,7 @@ impl<'a> TunToProxy<'a> {
|
|||
close_state: 0,
|
||||
wait_read: true,
|
||||
wait_write: false,
|
||||
expiry,
|
||||
udp_acco_expiry: expiry,
|
||||
udp_socket,
|
||||
udp_token,
|
||||
udp_origin_dst: None,
|
||||
|
@ -676,7 +676,7 @@ impl<'a> TunToProxy<'a> {
|
|||
|
||||
fn udp_associate_timeout_expired(&self, info: &ConnectionInfo) -> bool {
|
||||
if let Some(state) = self.connection_map.get(info) {
|
||||
if let Some(expiry) = state.expiry {
|
||||
if let Some(expiry) = state.udp_acco_expiry {
|
||||
return expiry < ::std::time::Instant::now();
|
||||
}
|
||||
}
|
||||
|
@ -804,7 +804,8 @@ impl<'a> TunToProxy<'a> {
|
|||
fn receive_udp_packet_and_write_to_client(&mut self, info: &ConnectionInfo) -> Result<()> {
|
||||
let err = "udp connection state not found";
|
||||
let state = self.connection_map.get_mut(info).ok_or(err)?;
|
||||
state.expiry = Some(Self::udp_associate_timeout());
|
||||
assert!(state.udp_acco_expiry.is_some());
|
||||
state.udp_acco_expiry = Some(Self::udp_associate_timeout());
|
||||
let mut to_send: LinkedList<Vec<u8>> = LinkedList::new();
|
||||
if let Some(udp_socket) = state.udp_socket.as_ref() {
|
||||
let mut buf = [0; 1 << 16];
|
||||
|
|
Loading…
Add table
Reference in a new issue