cjdelisle / packetcrypt_rs

PacketCrypt in Rust
53 stars 43 forks source link

Load ann miner settings from config file #50

Closed 3rror404 closed 2 years ago

3rror404 commented 2 years ago

Allows some or all of the ann miner settings to be loaded via a JSON file.

Provide either a path to a local file or a URL to a web-accessible file/API in the --config CLI argument.

./target/release/packetcrypt ann --config "/path/to/config.json"

Or

./target/release/packetcrypt ann --config https://example.com/config.json

A config.json file can be generated here for testing: https://config.pkt.watch


I’m a Rust novice. I’m not 100% confident with the code. So feel free to point out anything that looks poor/wrong and I’ll try to fix it.

cjdelisle commented 2 years ago

Agree, better put serde / serde_json at 1.0 and let bug fixes happen from time to time. Of course I would update just after a release rather than before, but it's the same idea.

3rror404 commented 2 years ago

Thanks guys. My understanding was that only the left most number is pegged. So using 1.0.136 would allow any versions >=1.0.136 & < 2.0.0. Am I reading this incorrectly?

The string "0.1.12" is a version requirement. Although it looks like a specific version of the time crate, it actually specifies a range of versions and allows SemVer compatible updates. An update is allowed if the new version number does not modify the left-most non-zero digit in the major, minor, patch grouping

https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-cratesio

Frank-Buss commented 2 years ago

Interesting, didn't know this, this doesn't look very intuitive :-) But maybe still better to just use 1.0, unless you need at least 1.0.136.

3rror404 commented 2 years ago

Just testing now. I don't think 1.0.136 is necessary - I only used that version because it was used in the snippet on crates.io.

rsalmei commented 2 years ago

Out of curiosity, cargo does use some unintuitive SemVer ranges. The one we grow to expect would be the tilde requirements which is not much used. There are special cases for "0.x.x" versions, which are deemed not stable yet, and also for "1.x.x" ones.