update for windows
This commit is contained in:
parent
b60c6ad687
commit
9f84fc6efa
5 changed files with 20 additions and 1 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use super::*;
|
||||
use anyhow::Result;
|
||||
use crate::daemon::DaemonResponse;
|
||||
|
||||
pub async fn listen(
|
||||
_cmd_tx: async_channel::Sender<DaemonCommand>,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tun::TunInterface;
|
||||
use anyhow::anyhow;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, JsonSchema)]
|
||||
pub struct DaemonResponse {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
pub mod wireguard;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
mod daemon;
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
pub use daemon::{
|
||||
DaemonClient, DaemonCommand, DaemonResponse, DaemonResponseData, DaemonStartOptions, ServerInfo,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use anyhow::{Context, Result};
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use tracing::instrument;
|
||||
use tracing_log::LogTracer;
|
||||
|
|
@ -8,12 +7,16 @@ use tracing_subscriber::{prelude::*, EnvFilter, FmtSubscriber};
|
|||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
use tun::TunInterface;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
mod daemon;
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
mod wireguard;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
use daemon::{DaemonClient, DaemonCommand, DaemonStartOptions};
|
||||
use tun::TunOptions;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
use crate::daemon::DaemonResponseData;
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
@ -184,6 +187,7 @@ async fn try_serverinfo() -> Result<()> {
|
|||
async fn try_serverconfig() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
initialize_tracing().await?;
|
||||
|
|
@ -226,3 +230,8 @@ fn system_log() -> Result<Option<tracing_journald::Layer>> {
|
|||
fn system_log() -> Result<Option<OsLogger>> {
|
||||
Ok(Some(OsLogger::new("com.hackclub.burrow", "burrow-cli")))
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_vendor = "apple")))]
|
||||
pub fn main(){
|
||||
eprintln!("This platform is not supported currently.")
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ use std::io::Error;
|
|||
|
||||
use fehler::throws;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
#[cfg(feature = "tokio")]
|
||||
use super::tokio::TunInterface;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
|
@ -47,6 +49,8 @@ impl TunOptions {
|
|||
self
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
|
||||
#[cfg(feature = "tokio")]
|
||||
#[throws]
|
||||
pub fn open(self) -> TunInterface {
|
||||
let ti = super::TunInterface::new_with_options(self)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue