From cdc798ad4cc4eb2b318c50a2853395e283ef26df Mon Sep 17 00:00:00 2001 From: zu1k Date: Thu, 18 Apr 2024 10:10:10 +0000 Subject: [PATCH] Bump version to 0.6.0 --- .github/dependabot.yml | 2 +- .github/workflows/build-docker-image.yml | 18 +- .github/workflows/build-release.yml | 53 ++--- .github/workflows/build-test.yml | 20 +- Cargo.lock | 283 +++++++++++++---------- Cargo.toml | 8 +- Dockerfile | 4 +- Makefile | 18 +- build/build-host-release.ps1 | 14 +- rust-toolchain.toml | 4 + src/srun.rs | 11 +- 11 files changed, 240 insertions(+), 195 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 92bb2ac..7598178 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,5 +3,5 @@ updates: - package-ecosystem: cargo directory: "/" schedule: - interval: weekly + interval: monthly open-pull-requests-limit: 0 diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index b183314..881fd26 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -8,22 +8,28 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker metadata id: metadata - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/srun + - name: Build and release Docker images - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: platforms: linux/386,linux/amd64,linux/arm64/v8 target: srun diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index f7decb6..90b8bb0 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -16,35 +16,26 @@ jobs: matrix: target: - i686-unknown-linux-musl - - x86_64-pc-windows-gnu - - x86_64-unknown-linux-gnu - x86_64-unknown-linux-musl - armv7-unknown-linux-musleabihf - - armv7-unknown-linux-gnueabihf - - arm-unknown-linux-gnueabi - - arm-unknown-linux-gnueabihf - arm-unknown-linux-musleabi - arm-unknown-linux-musleabihf - - aarch64-unknown-linux-gnu - aarch64-unknown-linux-musl - mips-unknown-linux-musl - - mips-unknown-linux-gnu - mipsel-unknown-linux-musl + - mips64-unknown-linux-muslabi64 + - mips64el-unknown-linux-muslabi64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependences run: sudo apt-get update -y && sudo apt-get install -y upx; - - name: Install Rust - uses: actions-rs/toolchain@v1 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master with: - profile: minimal - target: ${{ matrix.target }} - toolchain: nightly - default: true - override: true + toolchain: nightly-2024-04-17 - name: Install cross run: cargo install cross @@ -79,7 +70,7 @@ jobs: - x86_64-apple-darwin - aarch64-apple-darwin steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install GNU tar if: runner.os == 'macOS' @@ -88,14 +79,11 @@ jobs: # echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH - - name: Install Rust - uses: actions-rs/toolchain@v1 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master with: - profile: minimal - target: ${{ matrix.target }} - toolchain: nightly - default: true - override: true + toolchain: nightly-2024-04-17 + targets: ${{ matrix.target }} - name: Build release shell: bash @@ -115,20 +103,23 @@ jobs: env: RUSTFLAGS: "-C target-feature=+crt-static" RUST_BACKTRACE: full + strategy: + matrix: + target: + - x86_64-pc-windows-msvc + - i686-pc-windows-msvc + - aarch64-pc-windows-msvc steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Install Rust - uses: actions-rs/toolchain@v1 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master with: - profile: minimal - toolchain: nightly - default: true - override: true + toolchain: nightly-2024-04-17 - name: Build release run: | - pwsh ./build/build-host-release.ps1 + pwsh ./build/build-host-release.ps1 -t ${{ matrix.target }} - name: Upload Github Assets uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2bc5042..4d8a6aa 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -7,8 +7,8 @@ jobs: env: AUTH_SERVER_IP: ${{ secrets.AUTH_SERVER_IP }} steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -17,20 +17,18 @@ jobs: ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + - name: Setup rust toolchain run: rustup show - - name: cargo build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all-targets + - name: cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check + - name: cargo clippy uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} # args: --all-features + + - name: cargo build + run: cargo build --release --all-targets diff --git a/Cargo.lock b/Cargo.lock index 4c922a4..689082f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,9 +46,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.7" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" [[package]] name = "bitflags" @@ -147,21 +147,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - [[package]] name = "errno" version = "0.3.8" @@ -215,6 +200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -249,6 +235,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -293,29 +280,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" +name = "hermit-abi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hmac" @@ -328,9 +296,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -339,12 +307,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", "pin-project-lite", ] @@ -354,61 +334,76 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" -version = "0.14.28" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", - "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http", "hyper", - "rustls 0.21.10", + "hyper-util", + "rustls 0.22.3", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -423,22 +418,12 @@ dependencies = [ [[package]] name = "if-addrs" -version = "0.10.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabb0019d51a643781ff15c9c8a3e5dedc365c47211270f4e8f82812fedd8f0a" +checksum = "bb2a33e9c38988ecbda730c85b0fd9ddcdf83c0305ac7fd21c8bb9f57f2f0cc8" dependencies = [ "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", + "windows-sys 0.52.0", ] [[package]] @@ -546,6 +531,16 @@ dependencies = [ "tempfile", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "object" version = "0.32.2" @@ -611,6 +606,26 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -655,21 +670,22 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "3e6cc1e89e689536eb5aeede61520e874df5a4707df811cd5da4aa5fbb2aae19" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", "bytes", - "encoding_rs", + "futures-channel", "futures-core", "futures-util", - "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -678,13 +694,13 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.10", + "rustls 0.22.3", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -693,7 +709,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.25.4", + "webpki-roots 0.26.1", "winreg", ] @@ -760,32 +776,42 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" dependencies = [ "log", "ring 0.17.8", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" + [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring 0.17.8", + "rustls-pki-types", "untrusted 0.9.0", ] @@ -900,6 +926,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "socket2" version = "0.5.6" @@ -924,9 +956,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "srun" -version = "0.5.5" +version = "0.6.0" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", "getopts", "hmac", "if-addrs", @@ -964,27 +996,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tempfile" version = "3.10.1" @@ -1022,6 +1033,7 @@ dependencies = [ "bytes", "libc", "mio", + "num_cpus", "pin-project-lite", "socket2", "windows-sys 0.48.0", @@ -1039,28 +1051,37 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.21.10", + "rustls 0.22.3", + "rustls-pki-types", "tokio", ] [[package]] -name = "tokio-util" -version = "0.7.10" +name = "tower" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ - "bytes", "futures-core", - "futures-sink", + "futures-util", + "pin-project", "pin-project-lite", "tokio", + "tower-layer", + "tower-service", "tracing", ] +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -1073,6 +1094,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] @@ -1288,9 +1310,12 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "winapi" @@ -1455,10 +1480,16 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", ] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 44c0390..cec58d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "srun" -version = "0.5.5" +version = "0.6.0" authors = ["zu1k "] edition = "2021" description = "Srun authentication system login tools" @@ -21,14 +21,14 @@ panic = "abort" [dependencies] -base64 = "0.21" +base64 = "0.22" getopts = "0.2" hmac = "0.12" -if-addrs = "0.10" +if-addrs = "0.12" lazy_static = "1.4" md-5 = "0.10" quick-error = "2.0" -reqwest = { version = "0.11", default-features = false, features = ["blocking"], optional = true } +reqwest = { version = "0.12", default-features = false, features = ["blocking"], optional = true } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha-1 = "0.10" diff --git a/Dockerfile b/Dockerfile index 1d89c53..6f16761 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM rust:1.61.0-buster AS build +FROM --platform=$BUILDPLATFORM rust:1.77-buster AS build ARG TARGETARCH ARG AUTH_SERVER_IP @@ -36,7 +36,7 @@ RUN rustup install nightly && rustup default nightly && \ mv target/$RUST_TARGET/release/srun target/release/ && \ upx -9 target/release/srun -FROM alpine:3.14 AS srun +FROM alpine:3.19 AS srun COPY --from=build /root/srun/target/release/srun /usr/bin ENTRYPOINT [ "srun" ] diff --git a/Makefile b/Makefile index f685580..338193a 100755 --- a/Makefile +++ b/Makefile @@ -8,14 +8,16 @@ UPX=-upx --best --lzma TLS=FALSE CROSS_TARGET_LIST = \ - x86_64-unknown-linux-musl \ - i686-unknown-linux-musl \ - aarch64-unknown-linux-musl \ - armv7-unknown-linux-musleabihf \ - mips-unknown-linux-musl \ - mipsel-unknown-linux-musl \ - mips64-unknown-linux-muslabi64 \ - mips64el-unknown-linux-muslabi64 + i686-unknown-linux-musl \ + x86_64-unknown-linux-musl \ + armv7-unknown-linux-musleabihf \ + arm-unknown-linux-musleabi \ + arm-unknown-linux-musleabihf \ + aarch64-unknown-linux-musl \ + mips-unknown-linux-musl \ + mipsel-unknown-linux-musl \ + mips64-unknown-linux-muslabi64 \ + mips64el-unknown-linux-muslabi64 $(CROSS_TARGET_LIST): ifeq ($(TLS),TRUE) diff --git a/build/build-host-release.ps1 b/build/build-host-release.ps1 index 6f7bcae..dbddaba 100755 --- a/build/build-host-release.ps1 +++ b/build/build-host-release.ps1 @@ -5,7 +5,12 @@ choco install openssl #> + param( + [Parameter(HelpMessage = "Specify the target triple directly")] + [Alias('t')] + [string]$TargetTriple, + [Parameter(HelpMessage = "extra features")] [Alias('f')] [string]$Features @@ -13,7 +18,14 @@ param( $ErrorActionPreference = "Stop" -$TargetTriple = (rustc -Vv | Select-String -Pattern "host: (.*)" | ForEach-Object { $_.Matches.Value }).split()[-1] + +if (-not $PSBoundParameters.ContainsKey('TargetTriple')) { + try { + $TargetTriple = (rustc -Vv | Select-String -Pattern "host: (.*)" | ForEach-Object { $_.Matches.Value }).split()[-1] + } catch { + Write-Error "Unable to determine TargetTriple automatically" + } +} Write-Host "Started building release for ${TargetTriple} ..." diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..4098c9c --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly" +components = [ "rustfmt", "clippy", "rust-src", "rust-std" ] +profile = "minimal" diff --git a/src/srun.rs b/src/srun.rs index 0d7bdc8..23edafc 100644 --- a/src/srun.rs +++ b/src/srun.rs @@ -111,11 +111,11 @@ impl SrunClient { } pub fn set_os(&mut self, os: &str) { - self.os = os.to_owned(); + self.os = os.to_string(); } pub fn set_name(&mut self, name: &str) { - self.name = name.to_owned(); + self.name = name.to_string(); } pub fn set_retry_delay(&mut self, d: u32) { @@ -162,7 +162,7 @@ impl SrunClient { }) } - fn detect_ip(&mut self) -> Result { + fn detect_ip(&mut self) -> Result<()> { self.time = unix_second() - 2; let req = self .get_http_client()? @@ -193,7 +193,7 @@ impl SrunClient { if !challenge.online_ip.is_empty() { self.client_ip = challenge.online_ip; } - return Ok(self.client_ip.clone()); + Ok(()) } fn get_token(&mut self) -> Result { @@ -280,7 +280,7 @@ impl SrunClient { ); let check_sum = { - let check_sum = vec![ + let check_sum = [ "", &self.username, &hmd5, @@ -433,6 +433,7 @@ struct PortalResponse { st: u64, } +#[allow(dead_code)] #[derive(Deserialize, Debug)] #[serde(untagged)] enum ECode {