modularize discovery (wip)

This commit is contained in:
awiouy 2018-02-05 09:31:09 +01:00
parent 977a6db3ef
commit 38c64e54be
4 changed files with 36 additions and 14 deletions

View file

@ -24,6 +24,8 @@ doc = false
path = "audio"
[dependencies.librespot-core]
path = "core"
[dependencies.librespot-discovery]
path = "discovery"
[dependencies.librespot-metadata]
path = "metadata"
[dependencies.librespot-protocol]
@ -36,7 +38,6 @@ futures = "0.1.8"
getopts = "0.2.14"
hyper = "0.11.2"
log = "0.3.5"
mdns = { git = "https://github.com/plietar/rust-mdns" }
num-bigint = "0.1.35"
protobuf = "1.1"
rand = "0.3.13"
@ -55,7 +56,6 @@ portaudio-rs = { version = "0.3.0", optional = true }
libpulse-sys = { version = "0.0.0", optional = true }
jack = { version = "0.5.3", optional = true }
libc = { version = "0.2", optional = true }
dns-sd = { version = "0.1.3", optional = true }
[build-dependencies]
rand = "0.3.13"
@ -71,7 +71,7 @@ jackaudio-backend = ["jack"]
with-tremor = ["librespot-audio/with-tremor"]
with-lewton = ["librespot-audio/with-lewton"]
with-dns-sd = ["dns-sd"]
with-dns-sd = ["librespot-discovery/with-dns-sd"]
default = ["portaudio-backend"]

23
discovery/Cargo.toml Normal file
View file

@ -0,0 +1,23 @@
[package]
name = "librespot-discovery"
version = "0.1.0"
authors = ["Paul Lietar <paul@lietar.net>"]
[dependencies.librespot-core]
path = "../core"
[dependencies]
base64 = "0.5.0"
futures = "0.1.8"
num-bigint = "0.1.35"
rand = "0.3.13"
rust-crypto = { git = "https://github.com/awmath/rust-crypto.git", branch = "avx2" }
tokio-core = "0.1.2"
url = "1.3"
dns-sd = { version = "0.1.3", optional = true }
mdns = { git = "https://github.com/plietar/rust-mdns", optional = true }
[features]
with-dns-sd = ["dns-sd"]
with-mdns = ["mdns"]

View file

@ -1,4 +1,8 @@
use base64;
use core::diffie_hellman::{DH_GENERATOR, DH_PRIME};
use core::authentication::Credentials;
use core::util;
use core::config::ConnectConfig;
use crypto::digest::Digest;
use crypto::mac::Mac;
use crypto;
@ -6,13 +10,6 @@ use futures::sync::mpsc;
use futures::{Future, Stream, Poll};
use hyper::server::{Service, Request, Response, Http};
use hyper::{self, Get, Post, StatusCode};
#[cfg(feature = "with-dns-sd")]
use dns_sd::DNSService;
#[cfg(not(feature = "with-dns-sd"))]
use mdns;
use num_bigint::BigUint;
use rand;
use std::collections::BTreeMap;
@ -21,10 +18,11 @@ use std::sync::Arc;
use tokio_core::reactor::Handle;
use url;
use core::diffie_hellman::{DH_GENERATOR, DH_PRIME};
use core::authentication::Credentials;
use core::util;
use core::config::ConnectConfig;
#[cfg(feature = "with-dns-sd")]
use dns_sd::DNSService;
#[cfg(not(feature = "with-dns-sd"))]
use mdns;
#[derive(Clone)]
struct Discovery(Arc<DiscoveryInner>);

View file

@ -18,6 +18,7 @@ extern crate url;
pub extern crate librespot_audio as audio;
pub extern crate librespot_core as core;
pub extern crate librespot_discovery as discovery;
pub extern crate librespot_protocol as protocol;
pub extern crate librespot_metadata as metadata;