1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use std::net::IpAddr; //@todo review this. I'm not sure if this is the best strategy here, but I'd like for the ability //to pass some information to the implementer of traits. I.E. For logging in, the implementer //probably wants the IP of the connection that is attempting to log in, so that they can rate limit //or ban. Further, for share submitting and other features, the implementer probably wants the same //ability. Rather than pass the entire stream into the trait functions, I figured we should build a //struct that holds some information about the miner that can be edited and passed into those //functions. #[derive(Clone, Debug)] pub struct MinerInfo { pub ip: IpAddr, pub auth: Option<MinerAuth>, pub sid: Option<String>, pub job_stats: Option<MinerJobStats>, } #[derive(Clone, Debug)] pub struct MinerAuth { //@todo maybe force this to be UUID pub id: String, pub username: String, } #[derive(Clone, Debug)] pub struct MinerJobStats { pub expected_difficulty: f64, }