Skip to content

Commit 6f358a4

Browse files
authored
Merge pull request #3 from LinkTed/update-dependencies
Updated dependencies
2 parents defbf27 + 080f2ac commit 6f358a4

File tree

6 files changed

+34
-59
lines changed

6 files changed

+34
-59
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,29 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Install toolchain with rustfmt
18-
uses: actions-rs/toolchain@v1
18+
uses: dtolnay/rust-toolchain@stable
1919
with:
20-
toolchain: stable
2120
components: rustfmt
22-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2322
- name: Run rustfmt
2423
run: cargo fmt --all -- --check
2524

26-
audit:
27-
name: Job audit
28-
runs-on: ubuntu-latest
29-
steps:
30-
- uses: actions/checkout@v1
31-
- name: Run audit
32-
uses: actions-rs/audit-check@v1
33-
with:
34-
token: ${{ secrets.GITHUB_TOKEN }}
35-
3625
clippy:
3726
name: Job clippy
3827
needs: rustfmt
3928
runs-on: ubuntu-latest
4029
steps:
4130
- name: Install toolchain with clippy
42-
uses: actions-rs/toolchain@v1
31+
uses: dtolnay/rust-toolchain@stable
4332
with:
44-
toolchain: stable
4533
components: clippy
46-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v4
4735
- name: Run clippy
48-
uses: actions-rs/clippy-check@v1
36+
uses: giraffate/clippy-action@v1
4937
with:
50-
token: ${{ secrets.GITHUB_TOKEN }}
51-
args: --all-features ---all-targets -- --deny warnings -A clippy::unknown-clippy-lints
38+
reporter: 'github-pr-check'
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
clippy_flags: --deny warnings -A clippy::unknown-clippy-lints
5241

5342
tests:
5443
name: Job tests
@@ -61,43 +50,29 @@ jobs:
6150
runs-on: ${{ matrix.os }}
6251
steps:
6352
- name: Install toolchain ${{ matrix.rust_channel }} on ${{ matrix.os }}
64-
uses: actions-rs/toolchain@v1
53+
uses: dtolnay/rust-toolchain@master
6554
with:
6655
toolchain: ${{ matrix.rust_channel }}
67-
- uses: actions/checkout@v2
56+
- uses: actions/checkout@v4
6857
- name: Run cargo test
69-
uses: actions-rs/cargo@v1
70-
with:
71-
command: test
72-
args: --no-default-features --features "${{ matrix.features }}"
58+
run: cargo test --no-default-features --features "${{ matrix.features }}"
7359

7460
code-coverage:
7561
name: Job code coverage
7662
needs: tests
7763
runs-on: ubuntu-latest
7864
steps:
7965
- name: Intall toolchain nightly on ubuntu-latest
80-
uses: actions-rs/toolchain@v1
81-
with:
82-
toolchain: nightly
83-
override: true
84-
- uses: actions/checkout@v2
85-
- name: Download and unpack grcov
86-
run: curl -L "$URL" | tar jxf -
87-
env:
88-
URL: 'https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2'
89-
- name: Run cargo test
90-
uses: actions-rs/cargo@v1
66+
uses: dtolnay/rust-toolchain@stable
9167
with:
92-
command: test
93-
args: --all-features
94-
env:
95-
CARGO_INCREMENTAL: '0'
96-
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
97-
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
98-
- name: Convert gcno and gcda files into lcov
99-
run: ./grcov --llvm target/debug -s . -t lcov -o lcov.info --ignore-not-existing --ignore "tests/*" --ignore "examples/*" --ignore "/*" --excl-line "^ *#\["
100-
- name: Upload coverage
101-
uses: codecov/codecov-action@v1
68+
components: llvm-tools-preview
69+
- uses: actions/checkout@v4
70+
- name: cargo install cargo-llvm-cov
71+
uses: taiki-e/install-action@cargo-llvm-cov
72+
- name: cargo llvm-cov
73+
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
74+
- name: Upload to codecov.io
75+
uses: codecov/codecov-action@v4
10276
with:
103-
file: lcov.info
77+
token: ${{ secrets.CODECOV_TOKEN }}
78+
env_vars: OS,RUST

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ keywords = ["doh", "dns", "stamps", "dnscrypt"]
1111
categories = ["parser-implementations", "encoding"]
1212

1313
[dependencies]
14-
base64 = "~0.13.0"
15-
bitflags = "~1.2.1"
16-
thiserror = "~1.0.23"
17-
trust-dns-resolver = { version = "~0.20.0", optional = true }
14+
base64 = "0.22"
15+
bitflags = "2"
16+
thiserror = "1"
17+
trust-dns-resolver = { version = "0.20", optional = true }
1818

1919
[features]
2020
default = []

src/decode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
Addr, AnonymizedDnsCryptRelay, DecodeError, DecodeResult, DnsCrypt, DnsOverHttps, DnsOverTls,
44
DnsPlain, DnsStamp, DnsStampType, ObliviousDoHTarget, Props,
55
};
6-
use base64::{decode_config, URL_SAFE_NO_PAD};
6+
use base64::{prelude::BASE64_URL_SAFE_NO_PAD, Engine};
77
use std::{
88
convert::{TryFrom, TryInto},
99
mem::size_of,
@@ -213,7 +213,7 @@ fn decode_props(buf: &[u8], offset: &mut usize) -> DecodeResult<Props> {
213213
/// Decode a Base64 encoded `&str` with a prefix `"sdns://"` to `std::vec::Vec<u8>`.
214214
fn decode_base64(stamp: &str) -> DecodeResult<Vec<u8>> {
215215
if let Some(base64) = stamp.strip_prefix("sdns://") {
216-
Ok(decode_config(base64, URL_SAFE_NO_PAD)?)
216+
Ok(BASE64_URL_SAFE_NO_PAD.decode(base64)?)
217217
} else {
218218
Err(DecodeError::InvalidInput {
219219
cause: "sdns:// prefix not present".to_string(),

src/encode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
Addr, AnonymizedDnsCryptRelay, DnsCrypt, DnsOverHttps, DnsOverTls, DnsPlain, DnsStamp,
44
DnsStampType, EncodeError, EncodeResult, ObliviousDoHTarget, Props,
55
};
6-
use base64::{encode_config, URL_SAFE_NO_PAD};
6+
use base64::{prelude::BASE64_URL_SAFE_NO_PAD, Engine};
77
use std::net::{IpAddr, SocketAddr};
88

99
/// Encode a `crate::DnsStampType` into a `std::vec::Vec<u8>`.
@@ -21,7 +21,7 @@ fn encode_props(buffer: &mut Vec<u8>, props: &Props) {
2121
fn encode_bytes(buffer: &mut Vec<u8>, bytes: impl AsRef<[u8]>) -> EncodeResult<()> {
2222
let bytes = bytes.as_ref();
2323
let len = bytes.len();
24-
if len <= std::u8::MAX as usize {
24+
if len <= u8::MAX as usize {
2525
buffer.push(len as u8);
2626
buffer.extend(bytes);
2727
Ok(())
@@ -115,7 +115,7 @@ fn encode_pk(buffer: &mut Vec<u8>, pk: &[u8; 32]) -> EncodeResult<()> {
115115
/// [`VLP()`]: https://dnscrypt.info/stamps-specifications#common-definitions
116116
fn encode_vlp<T: AsRef<[u8]>>(buffer: &mut Vec<u8>, vlp: &[T]) -> EncodeResult<()> {
117117
if vlp.is_empty() {
118-
encode_bytes(buffer, &[])
118+
encode_bytes(buffer, [])
119119
} else {
120120
let len = vlp.len();
121121
if let Some(array) = vlp.get(..(len - 1)) {
@@ -157,7 +157,7 @@ fn encode_bootstrap_ipi(buffer: &mut Vec<u8>, bootstrap_ipi: &[IpAddr]) -> Encod
157157

158158
/// Encode `[u8]` slice with Base64 and prepand `"sdns://"`.
159159
fn encode_base64(buffer: &[u8]) -> String {
160-
format!("sdns://{}", encode_config(buffer, URL_SAFE_NO_PAD))
160+
format!("sdns://{}", BASE64_URL_SAFE_NO_PAD.encode(buffer))
161161
}
162162

163163
/// Encode a `crate::DnsPlain` into a `std::vec::Vec<u8>` as `crate::DnsStampType::Plain`.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
non_upper_case_globals
1111
)]
1212
#![allow(clippy::cognitive_complexity)]
13-
#![deny(broken_intra_doc_links)]
1413
#![doc(test(
1514
no_crate_inject,
1615
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
@@ -31,6 +30,7 @@ bitflags! {
3130
/// Represent the [`props`].
3231
///
3332
/// [`props`]: https://dnscrypt.info/stamps-specifications#dnscrypt-stamps
33+
#[derive(Debug, Clone, PartialEq, Eq)]
3434
pub struct Props: u64 {
3535
/// If this flag is present then the server supports [DNSSEC].
3636
///

tests/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn parse_fail_three() {
2323
let stamp = "sdns://A";
2424
assert_eq!(
2525
stamp.parse::<DnsStamp>(),
26-
Err(DecodeError::Base64Error(Base64Error::InvalidLength))
26+
Err(DecodeError::Base64Error(Base64Error::InvalidLength(1)))
2727
)
2828
}
2929

0 commit comments

Comments
 (0)