diff --git a/core/src/session.rs b/core/src/session.rs index cb210a0f..af1c12cc 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -1,6 +1,4 @@ use bytes::Bytes; -use crypto::digest::Digest; -use crypto::sha1::Sha1; use futures::{Async, Future, IntoFuture, Poll, Stream}; use futures::sync::mpsc; use std::io; @@ -45,12 +43,6 @@ static SESSION_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; #[derive(Clone)] pub struct Session(Arc); -pub fn device_id(name: &str) -> String { - let mut h = Sha1::new(); - h.input_str(name); - h.result_str() -} - impl Session { pub fn connect( config: SessionConfig, diff --git a/core/src/util/int128.rs b/core/src/util/int128.rs index f79692ca..648c5aae 100644 --- a/core/src/util/int128.rs +++ b/core/src/util/int128.rs @@ -2,7 +2,7 @@ use std; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[allow(non_camel_case_types)] -pub struct u128 { +pub(crate) struct u128 { high: u64, low: u64, } diff --git a/core/src/util/mod.rs b/core/src/util/mod.rs index 9c373eaa..a41638bc 100644 --- a/core/src/util/mod.rs +++ b/core/src/util/mod.rs @@ -7,7 +7,7 @@ use std::ops::{Mul, Rem, Shr}; mod int128; -pub use util::int128::u128; +pub(crate) use util::int128::u128; pub fn rand_vec(rng: &mut G, size: usize) -> Vec { rng.gen_iter().take(size).collect() diff --git a/src/main.rs b/src/main.rs index 01c34421..0a9c2ad3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ extern crate librespot; extern crate tokio_core; extern crate tokio_io; extern crate tokio_signal; +extern crate crypto; use env_logger::LogBuilder; use futures::{Future, Async, Poll, Stream}; @@ -17,6 +18,8 @@ use std::str::FromStr; use tokio_core::reactor::{Handle, Core}; use tokio_io::IoStream; use std::mem; +use crypto::digest::Digest; +use crypto::sha1::Sha1; use librespot::core::authentication::{get_credentials, Credentials}; use librespot::core::cache::Cache; @@ -31,6 +34,12 @@ use librespot::playback::mixer::{self, Mixer}; use librespot::playback::player::Player; use librespot::connect::spirc::{Spirc, SpircTask}; +fn device_id(name: &str) -> String { + let mut h = Sha1::new(); + h.input_str(name); + h.result_str() +} + fn usage(program: &str, opts: &getopts::Options) -> String { let brief = format!("Usage: {} [options]", program); opts.usage(&brief) @@ -170,7 +179,7 @@ fn setup(args: &[String]) -> Setup { }; let session_config = { - let device_id = librespot::core::session::device_id(&name); + let device_id = device_id(&name); SessionConfig { user_agent: version::version_string(),