mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-19 00:07:52 +00:00
Compare commits
2 Commits
parse_and_
...
adb0d4bdb9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adb0d4bdb9 | ||
|
|
cb52c3d912 |
44
.github/workflows/ci.yml
vendored
44
.github/workflows/ci.yml
vendored
@@ -1,44 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main, master, develop]
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
RUST_BACKTRACE: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- run: cargo test --locked
|
|
||||||
|
|
||||||
clippy:
|
|
||||||
name: Clippy
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
components: clippy
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- run: cargo clippy --all-targets --all-features -- -D warnings
|
|
||||||
|
|
||||||
fmt:
|
|
||||||
name: Format
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
components: rustfmt
|
|
||||||
- run: cargo fmt --all -- --check
|
|
||||||
134
.github/workflows/release.yml
vendored
134
.github/workflows/release.yml
vendored
@@ -1,134 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build ${{ matrix.target }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
use_cross: false
|
|
||||||
- os: ubuntu-latest
|
|
||||||
target: x86_64-unknown-linux-musl
|
|
||||||
use_cross: false
|
|
||||||
- os: ubuntu-latest
|
|
||||||
target: aarch64-unknown-linux-gnu
|
|
||||||
use_cross: true
|
|
||||||
- os: macos-latest
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
use_cross: false
|
|
||||||
- os: macos-latest
|
|
||||||
target: aarch64-apple-darwin
|
|
||||||
use_cross: false
|
|
||||||
- os: windows-latest
|
|
||||||
target: x86_64-pc-windows-msvc
|
|
||||||
use_cross: false
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Install musl tools
|
|
||||||
if: matrix.target == 'x86_64-unknown-linux-musl'
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y musl-tools
|
|
||||||
|
|
||||||
- name: Install cross
|
|
||||||
if: matrix.use_cross
|
|
||||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
key: ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
if [ "${{ matrix.use_cross }}" == "true" ]; then
|
|
||||||
cross build --release --locked --target ${{ matrix.target }}
|
|
||||||
else
|
|
||||||
cargo build --release --locked --target ${{ matrix.target }}
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Get binary name
|
|
||||||
id: binary
|
|
||||||
run: |
|
|
||||||
name=$(grep '^name = ' Cargo.toml | head -1 | cut -d'"' -f2)
|
|
||||||
if [ "${{ runner.os }}" == "Windows" ]; then
|
|
||||||
echo "name=${name}.exe" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "name=${name}" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Strip binary
|
|
||||||
if: runner.os != 'Windows' && !matrix.use_cross
|
|
||||||
run: strip target/${{ matrix.target }}/release/${{ steps.binary.outputs.name }}
|
|
||||||
|
|
||||||
- name: Package
|
|
||||||
id: package
|
|
||||||
run: |
|
|
||||||
name=$(grep '^name = ' Cargo.toml | head -1 | cut -d'"' -f2)
|
|
||||||
target="${{ matrix.target }}"
|
|
||||||
binary="${{ steps.binary.outputs.name }}"
|
|
||||||
|
|
||||||
cd target/${target}/release
|
|
||||||
|
|
||||||
if [ "${{ runner.os }}" == "Windows" ]; then
|
|
||||||
archive="${name}-${target}.zip"
|
|
||||||
7z a ../../../${archive} ${binary}
|
|
||||||
echo "archive=${archive}" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
archive="${name}-${target}.tar.gz"
|
|
||||||
tar czf ../../../${archive} ${binary}
|
|
||||||
echo "archive=${archive}" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.target }}
|
|
||||||
path: ${{ steps.package.outputs.archive }}
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: Release
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- name: Generate changelog
|
|
||||||
run: |
|
|
||||||
if [ -n "$(git tag --sort=-creatordate | head -n 2 | tail -n 1)" ]; then
|
|
||||||
prev_tag=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
|
|
||||||
git log ${prev_tag}..HEAD --pretty=format:"- %s" > CHANGELOG.md
|
|
||||||
else
|
|
||||||
echo "Initial release" > CHANGELOG.md
|
|
||||||
fi
|
|
||||||
|
|
||||||
- uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
body_path: CHANGELOG.md
|
|
||||||
files: artifacts/**/*
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -609,7 +609,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "v2parser"
|
name = "v2parser"
|
||||||
version = "0.4.0"
|
version = "0.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"clap",
|
"clap",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "v2parser"
|
name = "v2parser"
|
||||||
version = "0.4.0"
|
version = "0.3.1"
|
||||||
edition = "2024"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@@ -15,9 +15,7 @@ serde = { version = "1.0.189", features = ["derive"] }
|
|||||||
serde_json = "1.0.107"
|
serde_json = "1.0.107"
|
||||||
urlencoding = "2"
|
urlencoding = "2"
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
tempfile = "3"
|
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
|
||||||
signal-hook = "0.3"
|
signal-hook = "0.3"
|
||||||
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
|
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
|
||||||
|
tempfile = "3"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ Options:
|
|||||||
--socksport <PORT> Optional SOCKS5 proxy port for inbound
|
--socksport <PORT> Optional SOCKS5 proxy port for inbound
|
||||||
--httpport <PORT> Optional HTTP proxy port for inbound
|
--httpport <PORT> Optional HTTP proxy port for inbound
|
||||||
--get-metadata Only print config meta data
|
--get-metadata Only print config meta data
|
||||||
|
--run Run xray-core with the generated config
|
||||||
|
--xray-binary <PATH> Path to xray-core binary (default: xray from PATH)
|
||||||
-h, --help Print help
|
-h, --help Print help
|
||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -64,6 +64,26 @@ impl XrayRunner {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_running(&mut self) -> bool {
|
||||||
|
if let Some(process) = &mut self.process {
|
||||||
|
match process.try_wait() {
|
||||||
|
Ok(Some(_)) => {
|
||||||
|
// Process has exited
|
||||||
|
self.process = None;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
Ok(None) => true, // Process is still running
|
||||||
|
Err(_) => {
|
||||||
|
// Error checking status, assume not running
|
||||||
|
self.process = None;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for XrayRunner {
|
impl Drop for XrayRunner {
|
||||||
|
|||||||
Reference in New Issue
Block a user