Merge pull request #289 from ikatson/clippy-1.83
Clippy updates + update Rust deps
This commit is contained in:
commit
fb4e4c5741
23 changed files with 602 additions and 451 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
rust_version: ["1.76", "1.78", "1.82"]
|
rust_version: ["1.78", "1.83"]
|
||||||
steps:
|
steps:
|
||||||
- name: rustup toolchain install ${{ matrix.rust_version }}
|
- name: rustup toolchain install ${{ matrix.rust_version }}
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
950
Cargo.lock
generated
950
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -14,7 +14,7 @@ where
|
||||||
{
|
{
|
||||||
struct Wrapper<'a>(&'a [u8]);
|
struct Wrapper<'a>(&'a [u8]);
|
||||||
|
|
||||||
impl<'a> Serialize for Wrapper<'a> {
|
impl Serialize for Wrapper<'_> {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ impl serde::de::Error for Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut BencodeDeserializer<'de> {
|
impl<'de> serde::de::Deserializer<'de> for &mut BencodeDeserializer<'de> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||||
|
|
@ -517,7 +517,7 @@ struct SeqAccess<'a, 'de> {
|
||||||
de: &'a mut BencodeDeserializer<'de>,
|
de: &'a mut BencodeDeserializer<'de>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'de> serde::de::MapAccess<'de> for MapAccess<'a, 'de> {
|
impl<'de> serde::de::MapAccess<'de> for MapAccess<'_, 'de> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>, Self::Error>
|
fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>, Self::Error>
|
||||||
|
|
@ -559,7 +559,7 @@ impl<'a, 'de> serde::de::MapAccess<'de> for MapAccess<'a, 'de> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'de> serde::de::SeqAccess<'de> for SeqAccess<'a, 'de> {
|
impl<'de> serde::de::SeqAccess<'de> for SeqAccess<'_, 'de> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Self::Error>
|
fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Self::Error>
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ impl<W: std::io::Write> BencodeSerializer<W> {
|
||||||
struct SerializeSeq<'ser, W: std::io::Write> {
|
struct SerializeSeq<'ser, W: std::io::Write> {
|
||||||
ser: &'ser mut BencodeSerializer<W>,
|
ser: &'ser mut BencodeSerializer<W>,
|
||||||
}
|
}
|
||||||
impl<'ser, W: std::io::Write> serde::ser::SerializeSeq for SerializeSeq<'ser, W> {
|
impl<W: std::io::Write> serde::ser::SerializeSeq for SerializeSeq<'_, W> {
|
||||||
type Ok = ();
|
type Ok = ();
|
||||||
|
|
||||||
type Error = SerError;
|
type Error = SerError;
|
||||||
|
|
@ -117,7 +117,7 @@ impl<'ser, W: std::io::Write> serde::ser::SerializeSeq for SerializeSeq<'ser, W>
|
||||||
struct SerializeTuple<'ser, W: std::io::Write> {
|
struct SerializeTuple<'ser, W: std::io::Write> {
|
||||||
ser: &'ser mut BencodeSerializer<W>,
|
ser: &'ser mut BencodeSerializer<W>,
|
||||||
}
|
}
|
||||||
impl<'ser, W: std::io::Write> serde::ser::SerializeTuple for SerializeTuple<'ser, W> {
|
impl<W: std::io::Write> serde::ser::SerializeTuple for SerializeTuple<'_, W> {
|
||||||
type Ok = ();
|
type Ok = ();
|
||||||
|
|
||||||
type Error = SerError;
|
type Error = SerError;
|
||||||
|
|
@ -139,7 +139,7 @@ struct SerializeMap<'ser, W: std::io::Write> {
|
||||||
tmp: BTreeMap<ByteBufOwned, ByteBufOwned>,
|
tmp: BTreeMap<ByteBufOwned, ByteBufOwned>,
|
||||||
last_key: Option<ByteBufOwned>,
|
last_key: Option<ByteBufOwned>,
|
||||||
}
|
}
|
||||||
impl<'ser, W: std::io::Write> serde::ser::SerializeMap for SerializeMap<'ser, W> {
|
impl<W: std::io::Write> serde::ser::SerializeMap for SerializeMap<'_, W> {
|
||||||
type Ok = ();
|
type Ok = ();
|
||||||
|
|
||||||
type Error = SerError;
|
type Error = SerError;
|
||||||
|
|
@ -182,7 +182,7 @@ struct SerializeStruct<'ser, W: std::io::Write> {
|
||||||
ser: &'ser mut BencodeSerializer<W>,
|
ser: &'ser mut BencodeSerializer<W>,
|
||||||
tmp: BTreeMap<&'static str, ByteBufOwned>,
|
tmp: BTreeMap<&'static str, ByteBufOwned>,
|
||||||
}
|
}
|
||||||
impl<'ser, W: std::io::Write> serde::ser::SerializeStruct for SerializeStruct<'ser, W> {
|
impl<W: std::io::Write> serde::ser::SerializeStruct for SerializeStruct<'_, W> {
|
||||||
type Ok = ();
|
type Ok = ();
|
||||||
|
|
||||||
type Error = SerError;
|
type Error = SerError;
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@ impl ByteBufT for ByteBufOwned {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ByteBufT for ByteBuf<'a> {
|
impl ByteBufT for ByteBuf<'_> {
|
||||||
fn as_slice(&self) -> &[u8] {
|
fn as_slice(&self) -> &[u8] {
|
||||||
self.as_ref()
|
self.as_ref()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct HexBytes<'a>(&'a [u8]);
|
struct HexBytes<'a>(&'a [u8]);
|
||||||
impl<'a> std::fmt::Display for HexBytes<'a> {
|
impl std::fmt::Display for HexBytes<'_> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
for byte in self.0 {
|
for byte in self.0 {
|
||||||
write!(f, "{byte:02x?}")?;
|
write!(f, "{byte:02x?}")?;
|
||||||
|
|
@ -71,13 +71,13 @@ fn debug_bytes(b: &[u8], f: &mut std::fmt::Formatter<'_>, debug_strings: bool) -
|
||||||
write!(f, "<{} bytes>", b.len())
|
write!(f, "<{} bytes>", b.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::fmt::Debug for ByteBuf<'a> {
|
impl std::fmt::Debug for ByteBuf<'_> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
debug_bytes(self.0, f, true)
|
debug_bytes(self.0, f, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::fmt::Display for ByteBuf<'a> {
|
impl std::fmt::Display for ByteBuf<'_> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
debug_bytes(self.0, f, false)
|
debug_bytes(self.0, f, false)
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ impl std::fmt::Display for ByteBufOwned {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CloneToOwned for ByteBuf<'a> {
|
impl CloneToOwned for ByteBuf<'_> {
|
||||||
type Target = ByteBufOwned;
|
type Target = ByteBufOwned;
|
||||||
|
|
||||||
fn clone_to_owned(&self, within_buffer: Option<&Bytes>) -> Self::Target {
|
fn clone_to_owned(&self, within_buffer: Option<&Bytes>) -> Self::Target {
|
||||||
|
|
@ -126,7 +126,7 @@ impl CloneToOwned for ByteBufOwned {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::convert::AsRef<[u8]> for ByteBuf<'a> {
|
impl std::convert::AsRef<[u8]> for ByteBuf<'_> {
|
||||||
fn as_ref(&self) -> &[u8] {
|
fn as_ref(&self) -> &[u8] {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
@ -144,13 +144,13 @@ impl std::borrow::Borrow<[u8]> for ByteBufOwned {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::borrow::Borrow<[u8]> for ByteBuf<'a> {
|
impl std::borrow::Borrow<[u8]> for ByteBuf<'_> {
|
||||||
fn borrow(&self) -> &[u8] {
|
fn borrow(&self) -> &[u8] {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::ops::Deref for ByteBuf<'a> {
|
impl std::ops::Deref for ByteBuf<'_> {
|
||||||
type Target = [u8];
|
type Target = [u8];
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
|
|
@ -190,7 +190,7 @@ impl From<Bytes> for ByteBufOwned {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> serde::ser::Serialize for ByteBuf<'a> {
|
impl serde::ser::Serialize for ByteBuf<'_> {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
|
|
@ -215,7 +215,7 @@ impl<'de> serde::de::Deserialize<'de> for ByteBufOwned {
|
||||||
{
|
{
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
|
|
||||||
impl<'de> serde::de::Visitor<'de> for Visitor {
|
impl serde::de::Visitor<'_> for Visitor {
|
||||||
type Value = ByteBufOwned;
|
type Value = ByteBufOwned;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl<'de> Deserialize<'de> for MessageType {
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
impl<'de> serde::de::Visitor<'de> for Visitor {
|
impl serde::de::Visitor<'_> for Visitor {
|
||||||
type Value = MessageType;
|
type Value = MessageType;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
|
@ -271,7 +271,7 @@ impl<'de> Deserialize<'de> for CompactPeerInfo {
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
impl<'de> serde::de::Visitor<'de> for Visitor {
|
impl serde::de::Visitor<'_> for Visitor {
|
||||||
type Value = CompactPeerInfo;
|
type Value = CompactPeerInfo;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ impl Serialize for PeerStore {
|
||||||
peers: &'a dashmap::DashMap<Id20, Vec<StoredPeer>>,
|
peers: &'a dashmap::DashMap<Id20, Vec<StoredPeer>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Serialize for SerializePeers<'a> {
|
impl Serialize for SerializePeers<'_> {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ pub struct BucketTreeIteratorItem<'a> {
|
||||||
pub leaf: &'a LeafBucket,
|
pub leaf: &'a LeafBucket,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BucketTreeIteratorItem<'a> {
|
impl BucketTreeIteratorItem<'_> {
|
||||||
pub fn random_within(&self) -> Id20 {
|
pub fn random_within(&self) -> Id20 {
|
||||||
generate_random_id(self.start, self.bits)
|
generate_random_id(self.start, self.bits)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,8 @@ tracing-subscriber = { version = "0.3", default-features = false, features = [
|
||||||
], optional = true }
|
], optional = true }
|
||||||
uuid = { version = "1.2", features = ["v4"] }
|
uuid = { version = "1.2", features = ["v4"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
url = "2"
|
url = { version = "=2.5.2", default-features = false } # can't upgrade yet until min version is Rust 1.81, see https://github.com/servo/rust-url/issues/992
|
||||||
|
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
backoff = "0.4.0"
|
backoff = "0.4.0"
|
||||||
dashmap = "6"
|
dashmap = "6"
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ impl<'a> FileOps<'a> {
|
||||||
processed_bytes: u64,
|
processed_bytes: u64,
|
||||||
is_broken: bool,
|
is_broken: bool,
|
||||||
}
|
}
|
||||||
impl<'a> CurrentFile<'a> {
|
impl CurrentFile<'_> {
|
||||||
fn remaining(&self) -> u64 {
|
fn remaining(&self) -> u64 {
|
||||||
self.fi.len - self.processed_bytes
|
self.fi.len - self.processed_bytes
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl Subscriber {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MakeWriter<'a> for Subscriber {
|
impl MakeWriter<'_> for Subscriber {
|
||||||
type Writer = LineWriter<Writer>;
|
type Writer = LineWriter<Writer>;
|
||||||
|
|
||||||
fn make_writer(&self) -> Self::Writer {
|
fn make_writer(&self) -> Self::Writer {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ tracing = "0.1.40"
|
||||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
url = "2"
|
url = { version = "2", default-features = false }
|
||||||
uuid = { version = "1", features = ["v4"] }
|
uuid = { version = "1", features = ["v4"] }
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ pub enum FileIteratorName<'a, BufType> {
|
||||||
Tree(&'a [BufType]),
|
Tree(&'a [BufType]),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, BufType> std::fmt::Debug for FileIteratorName<'a, BufType>
|
impl<BufType> std::fmt::Debug for FileIteratorName<'_, BufType>
|
||||||
where
|
where
|
||||||
BufType: AsRef<[u8]>,
|
BufType: AsRef<[u8]>,
|
||||||
{
|
{
|
||||||
|
|
@ -203,7 +203,7 @@ pub struct FileDetails<'a, BufType> {
|
||||||
pub symlink_path: Option<&'a [BufType]>,
|
pub symlink_path: Option<&'a [BufType]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, BufType> FileDetails<'a, BufType>
|
impl<BufType> FileDetails<'_, BufType>
|
||||||
where
|
where
|
||||||
BufType: AsRef<[u8]>,
|
BufType: AsRef<[u8]>,
|
||||||
{
|
{
|
||||||
|
|
@ -235,7 +235,7 @@ pub struct FileDetailsExt<'a, BufType> {
|
||||||
pub pieces: std::ops::Range<u32>,
|
pub pieces: std::ops::Range<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, BufType> FileDetailsExt<'a, BufType> {
|
impl<BufType> FileDetailsExt<'_, BufType> {
|
||||||
pub fn pieces_usize(&self) -> std::ops::Range<usize> {
|
pub fn pieces_usize(&self) -> std::ops::Range<usize> {
|
||||||
self.pieces.start as usize..self.pieces.end as usize
|
self.pieces.start as usize..self.pieces.end as usize
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@ impl ExtendedHandshake<ByteBuf<'static>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, ByteBuf> ExtendedHandshake<ByteBuf>
|
impl<ByteBuf> ExtendedHandshake<ByteBuf>
|
||||||
where
|
where
|
||||||
ByteBuf: ByteBufT,
|
ByteBuf: ByteBufT,
|
||||||
{
|
{
|
||||||
fn get_msgid(&self, msg_type: &'a [u8]) -> Option<u8> {
|
fn get_msgid(&self, msg_type: &[u8]) -> Option<u8> {
|
||||||
self.m.get(msg_type).copied()
|
self.m.get(msg_type).copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ where
|
||||||
struct Visitor<T> {
|
struct Visitor<T> {
|
||||||
p: PhantomData<T>,
|
p: PhantomData<T>,
|
||||||
}
|
}
|
||||||
impl<'de, T> serde::de::Visitor<'de> for Visitor<T>
|
impl<T> serde::de::Visitor<'_> for Visitor<T>
|
||||||
where
|
where
|
||||||
T: IpLike,
|
T: IpLike,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ impl<'a> Bitfield<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::fmt::Debug for Bitfield<'a> {
|
impl std::fmt::Debug for Bitfield<'_> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.debug_struct("Bitfield")
|
f.debug_struct("Bitfield")
|
||||||
.field("_ones", &self.data.count_ones())
|
.field("_ones", &self.data.count_ones())
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,4 @@ rand = "0.8"
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
reqwest = { version = "0.12", default-features = false, features = ["json"] }
|
reqwest = { version = "0.12", default-features = false, features = ["json"] }
|
||||||
bencode = { path = "../bencode", default-features = false, package = "librqbit-bencode", version = "3" }
|
bencode = { path = "../bencode", default-features = false, package = "librqbit-bencode", version = "3" }
|
||||||
url = "2"
|
url = { version = "2", default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ pub struct DictPeer<'a> {
|
||||||
port: u16,
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DictPeer<'a> {
|
impl DictPeer<'_> {
|
||||||
fn as_sockaddr(&self) -> SocketAddr {
|
fn as_sockaddr(&self) -> SocketAddr {
|
||||||
SocketAddr::new(self.ip, self.port)
|
SocketAddr::new(self.ip, self.port)
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +118,7 @@ where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
impl<'de> serde::de::Visitor<'de> for Visitor {
|
impl serde::de::Visitor<'_> for Visitor {
|
||||||
type Value = IpAddr;
|
type Value = IpAddr;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,18 @@ gethostname = "0.5.0"
|
||||||
librqbit-sha1-wrapper = { path = "../sha1w", version = "4", default-features = false }
|
librqbit-sha1-wrapper = { path = "../sha1w", version = "4", default-features = false }
|
||||||
librqbit-core = { version = "4", path = "../librqbit_core", default-features = false }
|
librqbit-core = { version = "4", path = "../librqbit_core", default-features = false }
|
||||||
mime_guess = "2.0.5"
|
mime_guess = "2.0.5"
|
||||||
url = "2.5.2"
|
url = { version = "2", default-features = false }
|
||||||
parking_lot = "0.12.3"
|
parking_lot = "0.12.3"
|
||||||
tokio-util = "0.7.11"
|
tokio-util = "0.7.11"
|
||||||
reqwest = { version = "0.12.7", default-features = false }
|
reqwest = { version = "0.12.7", default-features = false }
|
||||||
socket2 = "0.5.7"
|
socket2 = "0.5.7"
|
||||||
quick-xml = { version = "0.36.1", features = ["serialize"] }
|
quick-xml = { version = "0.37.1", features = ["serialize"] }
|
||||||
network-interface = "2.0.0"
|
network-interface = "2.0.0"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tracing-subscriber = "0.3.18"
|
tracing-subscriber = "0.3.18"
|
||||||
tower-http = { version = "0.5", features = ["trace"] }
|
tower-http = { version = "0.6.2", features = ["trace"] }
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "upnp-stub-server"
|
name = "upnp-stub-server"
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ pub mod browse {
|
||||||
|
|
||||||
// This COULD have been done with CDATA, but some Samsung TVs don't like that, they want
|
// This COULD have been done with CDATA, but some Samsung TVs don't like that, they want
|
||||||
// escaped XML instead.
|
// escaped XML instead.
|
||||||
let items_encoded = quick_xml::escape::escape(items_encoded.as_ref());
|
let items_encoded = quick_xml::escape::escape(items_encoded);
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
include_str!(
|
include_str!(
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ pub struct SsdpMSearchRequest<'a> {
|
||||||
pub st: &'a BStr,
|
pub st: &'a BStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SsdpMSearchRequest<'a> {
|
impl SsdpMSearchRequest<'_> {
|
||||||
fn matches_media_server(&self) -> bool {
|
fn matches_media_server(&self) -> bool {
|
||||||
if self.man != "\"ssdp:discover\"" {
|
if self.man != "\"ssdp:discover\"" {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -80,17 +80,15 @@ pub fn try_parse_ssdp<'a, 'h>(
|
||||||
}
|
}
|
||||||
|
|
||||||
match (host, man, st) {
|
match (host, man, st) {
|
||||||
(Some(host), Some(man), Some(st)) => {
|
(Some(host), Some(man), Some(st)) => Ok(SsdpMessage::MSearch(SsdpMSearchRequest {
|
||||||
return Ok(SsdpMessage::MSearch(SsdpMSearchRequest {
|
host: BStr::new(host),
|
||||||
host: BStr::new(host),
|
man: BStr::new(man),
|
||||||
man: BStr::new(man),
|
st: BStr::new(st),
|
||||||
st: BStr::new(st),
|
})),
|
||||||
}))
|
|
||||||
}
|
|
||||||
_ => bail!("not all of host, man and st are set"),
|
_ => bail!("not all of host, man and st are set"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return Ok(SsdpMessage::OtherRequest(req)),
|
_ => Ok(SsdpMessage::OtherRequest(req)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ reqwest = { version = "0.12", default-features = false }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
tokio = { version = "1", features = ["macros"] }
|
tokio = { version = "1", features = ["macros"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
url = "2"
|
url = { version = "2", default-features = false }
|
||||||
network-interface = { version = "2" }
|
network-interface = { version = "2" }
|
||||||
httparse = "1.9.4"
|
httparse = "1.9.4"
|
||||||
bstr = "1.10.0"
|
bstr = "1.10.0"
|
||||||
quick-xml = { version = "0.36.1", features = ["serialize"] }
|
quick-xml = { version = "0.37.1", features = ["serialize"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue