Skip to content

Commit

Permalink
Fix compilation on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Dec 2, 2024
1 parent c8f326d commit 027a979
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 47 deletions.
42 changes: 20 additions & 22 deletions talpid-core/src/tunnel_state_machine/connected_state.rs
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
use super::{
AfterDisconnect, ConnectingState, DisconnectingState, ErrorState, EventConsequence,
EventResult, SharedTunnelStateValues, TunnelCommand, TunnelCommandReceiver, TunnelState,
TunnelStateTransition,
};
use crate::{
dns::{DnsConfig, ResolvedDnsConfig},
firewall::FirewallPolicy,
resolver::LOCAL_DNS_RESOLVER,
tunnel::{TunnelEvent, TunnelMetadata},
};
use futures::{
channel::{mpsc, oneshot},
stream::Fuse,
StreamExt,
};
use futures::channel::{mpsc, oneshot};
use futures::stream::Fuse;
use futures::StreamExt;

#[cfg(target_os = "android")]
use talpid_tunnel::tun_provider::Error;
use talpid_types::{
net::{AllowedClients, AllowedEndpoint, TunnelParameters},
tunnel::{ErrorStateCause, FirewallPolicyError},
BoxedError, ErrorExt,
};

use talpid_types::net::{AllowedClients, AllowedEndpoint, TunnelParameters};
use talpid_types::tunnel::{ErrorStateCause, FirewallPolicyError};
use talpid_types::{BoxedError, ErrorExt};

#[cfg(target_os = "macos")]
use crate::dns::DnsConfig;
use crate::dns::ResolvedDnsConfig;
use crate::firewall::FirewallPolicy;
#[cfg(target_os = "macos")]
use crate::resolver::LOCAL_DNS_RESOLVER;
#[cfg(windows)]
use crate::tunnel::TunnelMonitor;
use crate::tunnel::{TunnelEvent, TunnelMetadata};

use super::connecting_state::TunnelCloseEvent;
use super::{
AfterDisconnect, ConnectingState, DisconnectingState, ErrorState, EventConsequence,
EventResult, SharedTunnelStateValues, TunnelCommand, TunnelCommandReceiver, TunnelState,
TunnelStateTransition,
};

pub(crate) type TunnelEventsReceiver =
Fuse<mpsc::UnboundedReceiver<(TunnelEvent, oneshot::Sender<()>)>>;
Expand Down
46 changes: 21 additions & 25 deletions talpid-core/src/tunnel_state_machine/connecting_state.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::{Duration, Instant};

use futures::channel::{mpsc, oneshot};
use futures::future::Fuse;
use futures::{FutureExt, StreamExt};
use talpid_routing::RouteManagerHandle;
use talpid_tunnel::{tun_provider::TunProvider, TunnelArgs, TunnelEvent, TunnelMetadata};
use talpid_types::net::{AllowedClients, AllowedEndpoint, AllowedTunnelTraffic, TunnelParameters};
use talpid_types::tunnel::{ErrorStateCause, FirewallPolicyError};
use talpid_types::ErrorExt;

use super::connected_state::TunnelEventsReceiver;
use super::{
AfterDisconnect, ConnectedState, DisconnectingState, ErrorState, EventConsequence, EventResult,
SharedTunnelStateValues, TunnelCommand, TunnelCommandReceiver, TunnelState,
TunnelStateTransition,
};
use crate::{
dns::DnsConfig,
firewall::FirewallPolicy,
resolver::LOCAL_DNS_RESOLVER,
tunnel::{self, TunnelMonitor},
};
use futures::{
channel::{mpsc, oneshot},
future::Fuse,
FutureExt, StreamExt,
};
use std::{
path::{Path, PathBuf},
sync::{Arc, Mutex},
thread,
time::{Duration, Instant},
};
use talpid_routing::RouteManagerHandle;
use talpid_tunnel::{tun_provider::TunProvider, TunnelArgs, TunnelEvent, TunnelMetadata};
use talpid_types::{
net::{AllowedClients, AllowedEndpoint, AllowedTunnelTraffic, TunnelParameters},
tunnel::{ErrorStateCause, FirewallPolicyError},
ErrorExt,
};

use super::connected_state::TunnelEventsReceiver;
#[cfg(target_os = "macos")]
use crate::dns::DnsConfig;
use crate::firewall::FirewallPolicy;
#[cfg(target_os = "macos")]
use crate::resolver::LOCAL_DNS_RESOLVER;
use crate::tunnel::{self, TunnelMonitor};

pub(crate) type TunnelCloseEvent = Fuse<oneshot::Receiver<Option<ErrorStateCause>>>;

Expand Down

0 comments on commit 027a979

Please sign in to comment.