Skip to content

Commit af18f54

Browse files
authored
Merge branch 'webrtc-rs:master' into master
2 parents da547c9 + 94a779d commit af18f54

File tree

51 files changed

+138
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+138
-397
lines changed

.github/workflows/cargo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
os: ["ubuntu-latest", "macos-latest"]
2222
toolchain:
23-
- 1.63.0 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
23+
- 1.65.0 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
2424
- stable
2525
runs-on: ${{ matrix.os }}
2626
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ This project is still in active and early development stage, please refer to the
105105

106106
### Toolchain
107107

108-
**Minimum Supported Rust Version:** `1.63.0`
108+
**Minimum Supported Rust Version:** `1.65.0`
109109

110110
Our minimum supported rust version(MSRV) policy is to support versions of the compiler released within the last six months. We don't eagerly bump the minimum version we support, instead the minimum will be bumped on a needed by needed basis, usually because downstream dependencies force us to.
111111

dtls/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "webrtc-dtls"
3-
version = "0.7.1"
3+
version = "0.7.2"
44
authors = ["Rain Liu <yuliu@webrtc.rs>"]
55
edition = "2021"
66
description = "A pure Rust implementation of DTLS"
@@ -35,7 +35,7 @@ aes-gcm = "0.10.1"
3535
ccm = "0.3.0"
3636
tokio = { version = "1.19", features = ["full"] }
3737
async-trait = "0.1.56"
38-
x25519-dalek = "2.0.0-pre.1"
38+
x25519-dalek = { version = "2.0.0-rc.2", features = ["static_secrets"] }
3939
signature = "1.2.2"
4040
x509-parser = "0.13.2"
4141
der-parser = "8.1"

dtls/src/config.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,36 +134,26 @@ pub(crate) type PskCallback = Arc<dyn (Fn(&[u8]) -> Result<Vec<u8>>) + Send + Sy
134134

135135
// ClientAuthType declares the policy the server will follow for
136136
// TLS Client Authentication.
137-
#[derive(Copy, Clone, PartialEq, Eq)]
137+
#[derive(Default, Copy, Clone, PartialEq, Eq)]
138138
pub enum ClientAuthType {
139+
#[default]
139140
NoClientCert = 0,
140141
RequestClientCert = 1,
141142
RequireAnyClientCert = 2,
142143
VerifyClientCertIfGiven = 3,
143144
RequireAndVerifyClientCert = 4,
144145
}
145146

146-
impl Default for ClientAuthType {
147-
fn default() -> Self {
148-
ClientAuthType::NoClientCert
149-
}
150-
}
151-
152147
// ExtendedMasterSecretType declares the policy the client and server
153148
// will follow for the Extended Master Secret extension
154-
#[derive(PartialEq, Eq, Copy, Clone)]
149+
#[derive(Default, PartialEq, Eq, Copy, Clone)]
155150
pub enum ExtendedMasterSecretType {
151+
#[default]
156152
Request = 0,
157153
Require = 1,
158154
Disable = 2,
159155
}
160156

161-
impl Default for ExtendedMasterSecretType {
162-
fn default() -> Self {
163-
ExtendedMasterSecretType::Request
164-
}
165-
}
166-
167157
pub(crate) fn validate_config(is_client: bool, config: &Config) -> Result<()> {
168158
if is_client && config.psk.is_some() && config.psk_identity_hint.is_none() {
169159
return Err(Error::ErrPskAndIdentityMustBeSetForClient);

dtls/src/content.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ use crate::error::*;
77
use std::io::{Read, Write};
88

99
// https://tools.ietf.org/html/rfc4346#section-6.2.1
10-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
10+
#[derive(Default, Copy, Clone, PartialEq, Eq, Debug)]
1111
pub enum ContentType {
1212
ChangeCipherSpec = 20,
1313
Alert = 21,
1414
Handshake = 22,
1515
ApplicationData = 23,
16+
#[default]
1617
Invalid,
1718
}
1819

@@ -28,12 +29,6 @@ impl From<u8> for ContentType {
2829
}
2930
}
3031

31-
impl Default for ContentType {
32-
fn default() -> Self {
33-
ContentType::Invalid
34-
}
35-
}
36-
3732
#[derive(PartialEq, Debug, Clone)]
3833
pub enum Content {
3934
ChangeCipherSpec(ChangeCipherSpec),

dtls/src/curve/named_curve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn elliptic_curve_keypair(curve: NamedCurve) -> Result<NamedCurveKeypair> {
5454
)
5555
}
5656
NamedCurve::X25519 => {
57-
let secret_key = x25519_dalek::StaticSecret::new(OsRng);
57+
let secret_key = x25519_dalek::StaticSecret::random_from_rng(OsRng);
5858
let public_key = x25519_dalek::PublicKey::from(&secret_key);
5959
(
6060
public_key.as_bytes().to_vec(),

dtls/src/handshake/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use handshake_message_server_hello_done::*;
3434
use handshake_message_server_key_exchange::*;
3535

3636
// https://tools.ietf.org/html/rfc5246#section-7.4
37-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
37+
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
3838
pub enum HandshakeType {
3939
HelloRequest = 0,
4040
ClientHello = 1,
@@ -47,6 +47,7 @@ pub enum HandshakeType {
4747
CertificateVerify = 15,
4848
ClientKeyExchange = 16,
4949
Finished = 20,
50+
#[default]
5051
Invalid,
5152
}
5253

@@ -88,12 +89,6 @@ impl From<u8> for HandshakeType {
8889
}
8990
}
9091

91-
impl Default for HandshakeType {
92-
fn default() -> Self {
93-
HandshakeType::Invalid
94-
}
95-
}
96-
9792
#[derive(PartialEq, Debug, Clone)]
9893
pub enum HandshakeMessage {
9994
//HelloRequest(errNotImplemented),

examples/examples/play-from-disk-h264/play-from-disk-h264.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async fn main() -> Result<()> {
172172
// Open a H264 file and start reading using our H264Reader
173173
let file = File::open(&video_file_name)?;
174174
let reader = BufReader::new(file);
175-
let mut h264 = H264Reader::new(reader);
175+
let mut h264 = H264Reader::new(reader, 1_048_576);
176176

177177
// Wait for connection established
178178
notify_video.notified().await;

mdns/src/message/header.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ impl Header {
5454
}
5555
}
5656

57-
#[derive(Copy, Clone, PartialOrd, PartialEq, Eq)]
57+
#[derive(Default, Copy, Clone, PartialOrd, PartialEq, Eq)]
5858
pub enum Section {
59+
#[default]
5960
NotStarted = 0,
6061
Header = 1,
6162
Questions = 2,
@@ -65,12 +66,6 @@ pub enum Section {
6566
Done = 6,
6667
}
6768

68-
impl Default for Section {
69-
fn default() -> Self {
70-
Section::NotStarted
71-
}
72-
}
73-
7469
impl From<u8> for Section {
7570
fn from(v: u8) -> Self {
7671
match v {

mdns/src/message/mod.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::fmt;
2222
// Message formats
2323

2424
// A Type is a type of DNS request and response.
25-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
25+
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq)]
2626
pub enum DnsType {
2727
// ResourceHeader.Type and question.Type
2828
A = 1,
@@ -43,15 +43,10 @@ pub enum DnsType {
4343
Axfr = 252,
4444
All = 255,
4545

46+
#[default]
4647
Unsupported = 0,
4748
}
4849

49-
impl Default for DnsType {
50-
fn default() -> Self {
51-
DnsType::Unsupported
52-
}
53-
}
54-
5550
impl From<u16> for DnsType {
5651
fn from(v: u16) -> Self {
5752
match v {
@@ -167,9 +162,10 @@ impl DnsClass {
167162
pub type OpCode = u16;
168163

169164
// An RCode is a DNS response status code.
170-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
165+
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq)]
171166
pub enum RCode {
172167
// Message.Rcode
168+
#[default]
173169
Success = 0,
174170
FormatError = 1,
175171
ServerFailure = 2,
@@ -179,12 +175,6 @@ pub enum RCode {
179175
Unsupported,
180176
}
181177

182-
impl Default for RCode {
183-
fn default() -> Self {
184-
RCode::Success
185-
}
186-
}
187-
188178
impl From<u8> for RCode {
189179
fn from(v: u8) -> Self {
190180
match v {

0 commit comments

Comments
 (0)