feat: added FreeBSD support
to make use of it, create a FreeBSD VM with curl installed and install rustup by default from rustup.rs, then run `cargo build -p sparse-05-server`
This commit is contained in:
@@ -12,12 +12,14 @@ pub const SPARSE_LINUX_SERVER_BINARY: &'static [u8] =
|
||||
#[cfg(not(debug_assertions))]
|
||||
pub const SPARSE_LINUX_SERVER_BINARY: &'static [u8] =
|
||||
include_bytes!(std::env!("SPARSE_LINUX_SERVER"));
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub const SPARSE_WINDOWS_SERVER_BINARY: &'static [u8] =
|
||||
include_bytes!("../../../../target/x86_64-pc-windows-gnu/debug/sparse-05-server.exe");
|
||||
#[cfg(not(debug_assertions))]
|
||||
pub const SPARSE_WINDOWS_SERVER_BINARY: &'static [u8] =
|
||||
include_bytes!(std::env!("SPARSE_WINDOWS_SERVER"));
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub const SPARSE_WINDOWS_SERVICE_BINARY: &'static [u8] =
|
||||
include_bytes!("../../../../target/x86_64-pc-windows-gnu/debug/sparse-05-server.exe");
|
||||
@@ -25,6 +27,9 @@ pub const SPARSE_WINDOWS_SERVICE_BINARY: &'static [u8] =
|
||||
pub const SPARSE_WINDOWS_SERVICE_BINARY: &'static [u8] =
|
||||
include_bytes!(std::env!("SPARSE_WINDOWS_SERVICE"));
|
||||
|
||||
pub const SPARSE_FREEBSD_SERVER_BINARY: &'static [u8] =
|
||||
include_bytes!("../../../sparse-05-freebsd-server");
|
||||
|
||||
pub async fn generate(mut name: PathBuf, port: u16, target: TargetOs) -> anyhow::Result<()> {
|
||||
let mut csprng = rand::thread_rng();
|
||||
let keypair = Keypair::generate(&mut csprng);
|
||||
@@ -53,6 +58,7 @@ pub async fn generate(mut name: PathBuf, port: u16, target: TargetOs) -> anyhow:
|
||||
|
||||
file.write_all(match target {
|
||||
TargetOs::Linux => SPARSE_LINUX_SERVER_BINARY,
|
||||
TargetOs::FreeBSD => SPARSE_FREEBSD_SERVER_BINARY,
|
||||
TargetOs::Windows => SPARSE_WINDOWS_SERVER_BINARY,
|
||||
TargetOs::WindowsService => SPARSE_WINDOWS_SERVICE_BINARY
|
||||
})
|
||||
|
||||
@@ -16,6 +16,7 @@ fn to_socket_addr(src: &str) -> Result<SocketAddr, std::io::Error> {
|
||||
|
||||
pub enum TargetOs {
|
||||
Linux,
|
||||
FreeBSD,
|
||||
Windows,
|
||||
WindowsService,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user