Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 142fbc4

Browse files
authored
update deps + loosen some requirements (#20)
rules: - for crates that are below v1.0 -> specify the precise version - If the code uses a feature that was added for example in X 0.3.17, then you should specify 0.3.17, which actually means "0.3.y where y >= 17" - for crates the are above or equal v1.0 -> specify only major version if the crate's API is minimal and won't change between minor versions OR specify major&minor versions otherwise tested with https://github.com/taiki-e/cargo-minimal-versions
1 parent 2d193c0 commit 142fbc4

File tree

4 files changed

+65
-30
lines changed

4 files changed

+65
-30
lines changed

.github/workflows/cargo.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,76 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
14-
name: Build and test
13+
check_and_test:
14+
name: Check and test
1515
strategy:
1616
matrix:
1717
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
18+
toolchain:
19+
- 1.56.1 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
20+
- stable
1821
runs-on: ${{ matrix.os }}
1922
steps:
20-
- uses: actions/checkout@v2
21-
- name: Build
22-
run: cargo build --verbose
23-
- name: Run tests
24-
run: cargo test --verbose
23+
- uses: actions/checkout@v3
24+
- name: Cache cargo registry
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cargo/registry
28+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: ${{ matrix.toolchain }}
32+
profile: minimal
33+
override: true
34+
- uses: actions-rs/cargo@v1
35+
with:
36+
command: check
37+
- uses: actions-rs/cargo@v1
38+
with:
39+
command: test
2540

2641
rustfmt_and_clippy:
27-
name: Check rustfmt style && run clippy
42+
name: Check rustfmt style and run clippy
2843
runs-on: ubuntu-latest
2944
steps:
30-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v3
3146
- uses: actions-rs/toolchain@v1
3247
with:
33-
toolchain: 1.55.0
48+
toolchain: stable
3449
profile: minimal
3550
components: clippy, rustfmt
3651
override: true
3752
- name: Cache cargo registry
38-
uses: actions/cache@v1
53+
uses: actions/cache@v3
3954
with:
4055
path: ~/.cargo/registry
4156
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
4257
- name: Run clippy
4358
uses: actions-rs/cargo@v1
4459
with:
4560
command: clippy
61+
args: -- -D warnings
4662
- name: Check formating
4763
uses: actions-rs/cargo@v1
4864
with:
4965
command: fmt
5066
args: --all -- --check
67+
68+
minimal_versions:
69+
name: Compile and test with minimal versions
70+
strategy:
71+
matrix:
72+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
73+
runs-on: ${{ matrix.os }}
74+
steps:
75+
- uses: actions/checkout@v3
76+
- name: Install latest nightly
77+
uses: actions-rs/toolchain@v1
78+
with:
79+
toolchain: nightly
80+
override: true
81+
- uses: taiki-e/install-action@cargo-hack
82+
- uses: taiki-e/install-action@cargo-minimal-versions
83+
- run: cargo minimal-versions check --workspace --all-features --ignore-private -v
84+
- run: cargo minimal-versions build --workspace --all-features --ignore-private -v
85+
- run: cargo minimal-versions test --workspace --all-features -v

Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ marshal = []
2121
sync = []
2222

2323
[dependencies]
24-
tokio = { version = "1.15.0", features = ["full"] }
25-
lazy_static = "1.4.0"
26-
async-trait = "0.1.52"
27-
ipnet = "2.3.1"
28-
log = "0.4.14"
29-
rand = "0.8.4"
30-
bytes = "1.1.0"
31-
thiserror = "1.0.30"
32-
parking_lot = "0.11.2"
24+
tokio = { version = "1.19", features = ["full"] }
25+
lazy_static = "1.4"
26+
async-trait = "0.1.56"
27+
ipnet = "2.5"
28+
log = "0.4"
29+
rand = "0.8.5"
30+
bytes = "1"
31+
thiserror = "~1.0.2"
32+
parking_lot = "0.12.1"
3333

3434
[target.'cfg(not(windows))'.dependencies]
35-
nix = "0.23"
36-
libc = "0.2.8"
35+
nix = "0.24.1"
36+
libc = "0.2.126"
3737

3838
[target.'cfg(windows)'.dependencies]
39-
bitflags = "1.2.1"
39+
bitflags = "1.3"
4040
winapi = { version = "0.3.9", features = [
4141
"basetsd",
4242
"guiddef",
@@ -46,14 +46,14 @@ winapi = { version = "0.3.9", features = [
4646
] }
4747

4848
[build-dependencies]
49-
cc = "1.0.72"
49+
cc = "1.0.73"
5050

5151
[dev-dependencies]
52-
tokio-test = "0.4.2"
52+
tokio-test = "0.4.0" # must match the min version of the `tokio` crate above
5353
env_logger = "0.9.0"
5454
chrono = "0.4.19"
5555
criterion = { version = "0.3.5", features = ["stable"]}
5656

5757
[[bench]]
5858
name = "bench"
59-
harness = false
59+
harness = false

src/conn/conn_bridge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ pub struct Bridge {
8484
impl Bridge {
8585
pub fn new(
8686
loss_chance: u8,
87-
filter_cb0: Option<Box<dyn Fn(&Bytes) -> bool + Send + Sync>>,
88-
filter_cb1: Option<Box<dyn Fn(&Bytes) -> bool + Send + Sync>>,
87+
filter_cb0: Option<FilterCbFn>,
88+
filter_cb1: Option<FilterCbFn>,
8989
) -> (Arc<Bridge>, impl Conn, impl Conn) {
9090
let (wr_tx0, rd_rx0) = mpsc::channel(1024);
9191
let (wr_tx1, rd_rx1) = mpsc::channel(1024);

src/vnet/nat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const DEFAULT_NAT_MAPPING_LIFE_TIME: Duration = Duration::from_secs(30);
2222
// - Port Mapping behavior
2323
// - Filtering behavior
2424
// See: https://tools.ietf.org/html/rfc4787
25-
#[derive(Debug, Copy, Clone, PartialEq)]
25+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
2626
pub enum EndpointDependencyType {
2727
// EndpointIndependent means the behavior is independent of the endpoint's address or port
2828
EndpointIndependent,
@@ -39,7 +39,7 @@ impl Default for EndpointDependencyType {
3939
}
4040

4141
// NATMode defines basic behavior of the NAT
42-
#[derive(Debug, Copy, Clone, PartialEq)]
42+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
4343
pub enum NatMode {
4444
// NATModeNormal means the NAT behaves as a standard NAPT (RFC 2663).
4545
Normal,

0 commit comments

Comments
 (0)