mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Make dns-sd optional
This commit is contained in:
parent
0984ad0bf0
commit
38351c9a87
6 changed files with 47 additions and 7 deletions
|
@ -14,5 +14,5 @@ before_install:
|
||||||
install:
|
install:
|
||||||
- cargo install --git https://github.com/stepancheg/rust-protobuf --rev 921c69b protobuf
|
- cargo install --git https://github.com/stepancheg/rust-protobuf --rev 921c69b protobuf
|
||||||
script:
|
script:
|
||||||
- cargo build --verbose
|
- cargo build --no-default-features --verbose
|
||||||
- cargo test --verbose
|
- cargo test --no-default-features --verbose
|
||||||
|
|
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-set 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bit-set 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dns-sd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dns-sd 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"eventual 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"eventual 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"json_macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"json_macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -80,8 +80,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dns-sd"
|
name = "dns-sd"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding"
|
name = "encoding"
|
||||||
|
|
|
@ -18,7 +18,6 @@ path = "protocol"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bit-set = "~0.2.0"
|
bit-set = "~0.2.0"
|
||||||
byteorder = "~0.4.2"
|
byteorder = "~0.4.2"
|
||||||
dns-sd = "~0.1.0"
|
|
||||||
eventual = "~0.1.5"
|
eventual = "~0.1.5"
|
||||||
getopts = "~0.2.14"
|
getopts = "~0.2.14"
|
||||||
json_macros = "~0.2.6"
|
json_macros = "~0.2.6"
|
||||||
|
@ -35,6 +34,10 @@ tempfile = "~1.1.3"
|
||||||
url = "~0.5.2"
|
url = "~0.5.2"
|
||||||
vorbis = "~0.0.13"
|
vorbis = "~0.0.13"
|
||||||
|
|
||||||
|
[dependencies.dns-sd]
|
||||||
|
version = "~0.1.1"
|
||||||
|
optional = true
|
||||||
|
|
||||||
[dependencies.protobuf_macros]
|
[dependencies.protobuf_macros]
|
||||||
git = "https://github.com/plietar/rust-protobuf-macros.git"
|
git = "https://github.com/plietar/rust-protobuf-macros.git"
|
||||||
[dependencies.shannon]
|
[dependencies.shannon]
|
||||||
|
@ -45,3 +48,5 @@ git = "https://github.com/mvdnes/portaudio-rs"
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
vergen = "~0.0.16"
|
vergen = "~0.0.16"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["dns-sd"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crypto;
|
use crypto;
|
||||||
use crypto::mac::Mac;
|
use crypto::mac::Mac;
|
||||||
use crypto::digest::Digest;
|
use crypto::digest::Digest;
|
||||||
use dns_sd::DNSService;
|
use zeroconf::DNSService;
|
||||||
use tiny_http::{Method, Response, ResponseBox, Server};
|
use tiny_http::{Method, Response, ResponseBox, Server};
|
||||||
use num::BigUint;
|
use num::BigUint;
|
||||||
use url;
|
use url;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
extern crate bit_set;
|
extern crate bit_set;
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
extern crate crypto;
|
extern crate crypto;
|
||||||
extern crate dns_sd;
|
|
||||||
extern crate eventual;
|
extern crate eventual;
|
||||||
extern crate num;
|
extern crate num;
|
||||||
extern crate portaudio;
|
extern crate portaudio;
|
||||||
|
@ -23,6 +22,9 @@ extern crate tempfile;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
extern crate vorbis;
|
extern crate vorbis;
|
||||||
|
|
||||||
|
#[cfg(feature = "dns-sd")]
|
||||||
|
extern crate dns_sd;
|
||||||
|
|
||||||
extern crate librespot_protocol;
|
extern crate librespot_protocol;
|
||||||
|
|
||||||
#[macro_use] pub mod util;
|
#[macro_use] pub mod util;
|
||||||
|
@ -39,4 +41,5 @@ pub mod player;
|
||||||
pub mod session;
|
pub mod session;
|
||||||
pub mod spirc;
|
pub mod spirc;
|
||||||
mod stream;
|
mod stream;
|
||||||
|
mod zeroconf;
|
||||||
|
|
||||||
|
|
29
src/zeroconf.rs
Normal file
29
src/zeroconf.rs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#[cfg(feature = "dns-sd")]
|
||||||
|
pub use dns_sd::*;
|
||||||
|
#[cfg(not(feature = "dns-sd"))]
|
||||||
|
pub use self::stub::*;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "dns-sd"))]
|
||||||
|
pub mod stub {
|
||||||
|
use std;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct DNSService;
|
||||||
|
|
||||||
|
pub type DNSError = ();
|
||||||
|
|
||||||
|
impl DNSService {
|
||||||
|
pub fn register(_: Option<&str>,
|
||||||
|
_: &str,
|
||||||
|
_: Option<&str>,
|
||||||
|
_: Option<&str>,
|
||||||
|
_: u16,
|
||||||
|
_: &[&str])
|
||||||
|
-> std::result::Result<DNSService, DNSError> {
|
||||||
|
writeln!(&mut std::io::stderr(),
|
||||||
|
"WARNING: dns-sd is not enabled. Service will probably not be visible").unwrap();
|
||||||
|
Ok(DNSService)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue