Skip to content

Commit

Permalink
support windows 7 building
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Sep 23, 2024
1 parent ddaa46b commit 03f5442
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 10 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Check

on:
[push, pull_request]
push:
branches:
- '**'
pull_request:
branches:
- '**'

env:
CARGO_TERM_COLOR: always
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mips-unknown-linux-gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build mips-unknown-linux-gnu Releases
on:
push:
tags:
- "*"
- "v*.*.*"
env:
CARGO_TERM_COLOR: always

Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/release-win7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build Releases
on:
push:
tags:
- "w*.*.*"
env:
CARGO_TERM_COLOR: always
RUST_VERSION: "1.75"

jobs:
build:
strategy:
fail-fast: false
matrix:
target:
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc

runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.target }}

- name: Prepare
shell: bash
run: |
cargo install cbindgen
mkdir release
rustup target add ${{ matrix.target }}
- name: Build
if: ${{ !cancelled() }}
shell: bash
run: |
cargo build --all-features --release --target ${{ matrix.target }}
cbindgen -c cbindgen.toml -l C --cpp-compat -o ./overtls.h
powershell Compress-Archive -Path target/${{ matrix.target }}/release/overtls-bin.exe, ./config.json, ./overtls.h, target/${{ matrix.target }}/release/overtls.dll -DestinationPath release/overtls-${{ matrix.target }}-win7.zip
- name: Upload
if: ${{ !cancelled() }}
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: release/*

- name: Abort on error
if: ${{ failure() }}
run: echo "Some of jobs failed" && false
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build Releases
on:
push:
tags:
- "*"
- "v*.*.*"
env:
CARGO_TERM_COLOR: always

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ license = "MIT"
description = "A simple proxy tunnel, minimalist tool for bypassing the GFW."
repository = "https://github.com/ShadowsocksR-Live/overtls"
readme = "readme.md"
rust-version = "1.80"

[lib]
crate-type = ["staticlib", "cdylib", "lib"]
Expand All @@ -31,6 +30,7 @@ futures-util = { version = "0.3", default-features = false, features = [
hickory-proto = "0.24"
http = "1"
httparse = "1"
lazy_static = "1"
log = { version = "0.4", features = ["std"] }
moka = { version = "0.12", default-features = false, features = ["future"] }
reqwest = { version = "0.12", default-features = false, features = [
Expand Down
11 changes: 5 additions & 6 deletions src/traffic_status.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::error::{Error, Result};
use std::{
os::raw::c_void,
sync::{LazyLock, Mutex},
};
use std::{os::raw::c_void, sync::Mutex};

/// # Safety
///
Expand Down Expand Up @@ -47,8 +44,10 @@ unsafe impl Sync for TrafficStatusCallback {}
static TRAFFIC_STATUS_CALLBACK: Mutex<Option<TrafficStatusCallback>> = Mutex::new(None);
static SEND_INTERVAL_SECS: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(1);

static TRAFFIC_STATUS: LazyLock<Mutex<TrafficStatus>> = LazyLock::new(|| Mutex::new(TrafficStatus::default()));
static TIME_STAMP: LazyLock<Mutex<std::time::Instant>> = LazyLock::new(|| Mutex::new(std::time::Instant::now()));
lazy_static::lazy_static! {
static ref TRAFFIC_STATUS: Mutex<TrafficStatus> = Mutex::new(TrafficStatus::default());
static ref TIME_STAMP: Mutex<std::time::Instant> = Mutex::new(std::time::Instant::now());
}

pub(crate) fn traffic_status_update(delta_tx: usize, delta_rx: usize) -> Result<()> {
{
Expand Down

0 comments on commit 03f5442

Please sign in to comment.