Add debugging task for VS Code
This allows you to launch the command line program into a debugger. This commit also tweaks the CI and fixes a small error in the build script.
This commit is contained in:
parent
02efa85a19
commit
b37086e8f6
6 changed files with 38 additions and 21 deletions
9
.github/workflows/build-rust.yml
vendored
9
.github/workflows/build-rust.yml
vendored
|
|
@ -15,6 +15,8 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
platform: Linux
|
platform: Linux
|
||||||
|
packages:
|
||||||
|
- gcc-aarch64-linux-gnu
|
||||||
targets:
|
targets:
|
||||||
- x86_64-unknown-linux-gnu
|
- x86_64-unknown-linux-gnu
|
||||||
- aarch64-unknown-linux-gnu
|
- aarch64-unknown-linux-gnu
|
||||||
|
|
@ -34,12 +36,19 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||||
|
RUST_BACKTRACE: short
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
- name: Install Packages
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
shell: bash
|
||||||
|
run: sudo apt-get install -y ${{ join(matrix.packages, ' ') }}
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
22
.vscode/launch.json
vendored
Normal file
22
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug",
|
||||||
|
"cargo": {
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"--bin=burrow",
|
||||||
|
],
|
||||||
|
"filter": {
|
||||||
|
"name": "burrow",
|
||||||
|
"kind": "bin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
bindings.write_to_file(out_dir.join("wintun.rs"))?;
|
bindings.write_to_file(out_dir.join("wintun.rs"))?;
|
||||||
|
|
||||||
let mut library = Vec::new();
|
let mut library = Vec::new();
|
||||||
let platform = platforms::Platform::find(&env::var("TARGET")?).unwrap();
|
let platform = platforms::Platform::find(&std::env::var("TARGET")?).unwrap();
|
||||||
let arch = match platform.target_arch {
|
let arch = match platform.target_arch {
|
||||||
platforms::target::Arch::Arm => "arm",
|
platforms::target::Arch::Arm => "arm",
|
||||||
platforms::Arch::AArch64 => "arm64",
|
platforms::Arch::AArch64 => "arm64",
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@ use std::io::Result;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use widestring::{u16cstr, U16CString};
|
use widestring::{u16cstr, U16CString};
|
||||||
|
|
||||||
|
mod queue;
|
||||||
|
|
||||||
|
pub use queue::TunQueue;
|
||||||
|
|
||||||
pub struct TunInterface {
|
pub struct TunInterface {
|
||||||
wintun: sys::wintun,
|
wintun: sys::wintun,
|
||||||
handle: sys::WINTUN_ADAPTER_HANDLE,
|
handle: sys::WINTUN_ADAPTER_HANDLE,
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1 @@
|
||||||
use crate::TunInterface;
|
pub struct TunQueue;
|
||||||
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
|
|
||||||
|
|
||||||
pub struct TunQueue {
|
|
||||||
inner: crate::windows::sys::
|
|
||||||
inner: socket2::Socket,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AsRawFd for TunQueue {
|
|
||||||
fn as_raw_fd(&self) -> RawFd {
|
|
||||||
self.socket.as_raw_fd()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IntoRawFd for TunQueue {
|
|
||||||
fn into_raw_fd(self) -> RawFd {
|
|
||||||
self.socket.into_raw_fd()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue