1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-04 10:19:27 +02:00

First working version of protocol handshake.

Key exchange and authentication is functional.
Protocol definition has been moved to separate crate to speed up build time.
Various cleanups. Take login info from command line, rather than hardcoded.
This commit is contained in:
Paul Liétar 2015-05-09 11:07:24 +01:00 committed by Paul Liétar
parent 15f39607e7
commit 1ad62e6f18
19 changed files with 821 additions and 290 deletions

View file

@ -1,8 +1,7 @@
#![crate_name = "librespot"]
#![feature(plugin,core)]
#![feature(plugin)]
#![plugin(mod_path)]
#![plugin(protobuf_macros)]
#[macro_use] extern crate lazy_static;
@ -11,18 +10,39 @@ extern crate crypto;
extern crate gmp;
extern crate num;
extern crate protobuf;
extern crate shannon;
extern crate rand;
extern crate readall;
extern crate librespot_protocol;
mod connection;
mod cryptoutil;
mod protocol;
mod keys;
mod session;
mod util;
use session::Session;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use session::{Session,Config};
fn main() {
let mut s = Session::new();
s.login();
let mut args = std::env::args().skip(1);
let mut appkey_file = File::open(Path::new(&args.next().unwrap())).unwrap();
let username = args.next().unwrap();
let password = args.next().unwrap();
let mut appkey = Vec::new();
appkey_file.read_to_end(&mut appkey).unwrap();
let config = Config {
application_key: appkey,
user_agent: "ABC".to_string(),
device_id: "ABC".to_string()
};
let mut s = Session::new(config);
s.login(username, password);
}