Switch to Rust 2018 edition

This commit is contained in:
Jonas Herzig 2020-04-03 20:55:59 +02:00
parent 0949807830
commit 8bdd654952
4 changed files with 11 additions and 27 deletions

View file

@ -2,6 +2,7 @@
name = "mumble-web-proxy" name = "mumble-web-proxy"
version = "0.1.0" version = "0.1.0"
authors = ["Jonas Herzig <me@johni0702.de>"] authors = ["Jonas Herzig <me@johni0702.de>"]
edition = "2018"
[dependencies] [dependencies]
argparse = "0.2.2" argparse = "0.2.2"

View file

@ -29,9 +29,9 @@ use tokio::prelude::*;
use tokio::timer::Delay; use tokio::timer::Delay;
use webrtc_sdp::attribute_type::SdpAttribute; use webrtc_sdp::attribute_type::SdpAttribute;
use error::Error; use crate::error::Error;
use utils::EitherS; use crate::utils::EitherS;
use Config; use crate::Config;
type SessionId = u32; type SessionId = u32;
@ -85,14 +85,14 @@ impl User {
pub struct Connection { pub struct Connection {
config: Config, config: Config,
inbound_client: Box<Stream<Item = ControlPacket<Serverbound>, Error = Error>>, inbound_client: Box<dyn Stream<Item = ControlPacket<Serverbound>, Error = Error>>,
outbound_client: Box<Sink<SinkItem = ControlPacket<Clientbound>, SinkError = Error>>, outbound_client: Box<dyn Sink<SinkItem = ControlPacket<Clientbound>, SinkError = Error>>,
inbound_server: Box<Stream<Item = ControlPacket<Clientbound>, Error = Error>>, inbound_server: Box<dyn Stream<Item = ControlPacket<Clientbound>, Error = Error>>,
outbound_server: Box<Sink<SinkItem = ControlPacket<Serverbound>, SinkError = Error>>, outbound_server: Box<dyn Sink<SinkItem = ControlPacket<Serverbound>, SinkError = Error>>,
next_clientbound_frame: Option<ControlPacket<Clientbound>>, next_clientbound_frame: Option<ControlPacket<Clientbound>>,
next_serverbound_frame: Option<ControlPacket<Serverbound>>, next_serverbound_frame: Option<ControlPacket<Serverbound>>,
next_rtp_frame: Option<Vec<u8>>, next_rtp_frame: Option<Vec<u8>>,
stream_to_be_sent: Option<Box<Stream<Item = Frame, Error = Error>>>, stream_to_be_sent: Option<Box<dyn Stream<Item = Frame, Error = Error>>>,
ice: Option<(ice::Agent, ice::Stream)>, ice: Option<(ice::Agent, ice::Stream)>,
@ -369,7 +369,7 @@ impl Connection {
fn process_packet_from_client( fn process_packet_from_client(
&mut self, &mut self,
packet: ControlPacket<Serverbound>, packet: ControlPacket<Serverbound>,
) -> Box<Stream<Item = Frame, Error = Error>> { ) -> Box<dyn Stream<Item = Frame, Error = Error>> {
match packet { match packet {
ControlPacket::Authenticate(mut message) => { ControlPacket::Authenticate(mut message) => {
println!("MSG Authenticate: {:?}", message); println!("MSG Authenticate: {:?}", message);

View file

@ -7,7 +7,7 @@ pub enum Error {
Io(std::io::Error), Io(std::io::Error),
ServerTls(native_tls::Error), ServerTls(native_tls::Error),
ClientConnection(tungstenite::Error), ClientConnection(tungstenite::Error),
Misc(Box<std::error::Error>), Misc(Box<dyn std::error::Error>),
} }
impl Error { impl Error {

View file

@ -1,23 +1,6 @@
// TODO For some reason, reconnecting without reloading the page and without disconnecting the // TODO For some reason, reconnecting without reloading the page and without disconnecting the
// previous connection (i.e. multiple simultaneous connections) causes FF to reject our DTLS // previous connection (i.e. multiple simultaneous connections) causes FF to reject our DTLS
// cert. Works in Chrome, or in different tabs or when properly closing the old connection. // cert. Works in Chrome, or in different tabs or when properly closing the old connection.
extern crate argparse;
extern crate byteorder;
extern crate bytes;
extern crate futures;
extern crate libnice;
extern crate mumble_protocol;
extern crate native_tls;
extern crate openssl;
extern crate rtp;
extern crate tokio;
extern crate tokio_codec;
extern crate tokio_core;
extern crate tokio_tls;
extern crate tokio_tungstenite;
extern crate tungstenite;
extern crate webrtc_sdp;
use argparse::StoreOption; use argparse::StoreOption;
use argparse::StoreTrue; use argparse::StoreTrue;
use argparse::{ArgumentParser, Store}; use argparse::{ArgumentParser, Store};