-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
44 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ipify-rs" | ||
version = "0.4.0" | ||
version = "0.5.0" | ||
edition = "2021" | ||
authors = ["Ollivier Robert <[email protected]>"] | ||
keywords = ["ipify", "api", "client"] | ||
|
@@ -15,6 +15,5 @@ documentation = "https://docs.rs/ipify-rs" | |
[dependencies] | ||
clap = "3.0.0-beta.5" | ||
log = "0.4" | ||
ureq = { version = "2", features = ["socks-proxy"] } | ||
reqwest = { version = "0.11.6", features = ["blocking"] } | ||
stderrlog = "0.5.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,21 +32,6 @@ The four operations are specified as below: | |
- `OP::IPv4J` (json output) | ||
- `Op::IPv6J` (json output) | ||
|
||
## HTTP engine | ||
|
||
This API can use either [ureq] or [reqwest] as HTTP client. You can select the engine with the `with()` method. The current version of `Ipify` only support the *blocking* client though. | ||
|
||
```rs | ||
use ipify_rs::{Engine, Ipify, Op}; | ||
|
||
let c = Ipify::new().with(Engine::Reqw).set(Op::IPv4); | ||
|
||
println!("My IP is {}", c.call()); | ||
``` | ||
|
||
[ureq]: https://docs.rs/crate/ureq/ | ||
[reqwest]: https://docs.rs/crate/reqwest/ | ||
|
||
## Minimalistic API | ||
|
||
If you only care about the default (plain text, IPv6 query) and don't want to reuse anything later, then `myip()` is what you want: | ||
|
@@ -63,7 +48,7 @@ fn main() { | |
|
||
There is a CLI utility bundled with the API called `ipify-cli`. | ||
``` | ||
ipify-cli 0.2.0 | ||
ipify-cli 0.4.0 | ||
Ollivier Robert <[email protected]> | ||
|
@@ -84,7 +69,8 @@ There is a CLI utility bundled with the API called `ipify-cli`. | |
You can see both API & CLI versions: | ||
``` | ||
$ ipify-cli -V | ||
Running API ipify-rs/0.2.0 CLI ipify-cli/0.1.0 | ||
CLI ipify-cli/0.4.0 using API ipify-rs/0.5.0 | ||
``` | ||
|
||
## Example | ||
|
@@ -96,14 +82,10 @@ The file `showall.rs` inside `examples` show almost all parameters for the API. | |
INFO - Start | ||
INFO - Using default, minimal API | ||
IP=aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh | ||
INFO - Using defaults (ureq, ipv6) | ||
INFO - Using defaults (ipv6) | ||
IP=aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh | ||
INFO - Using defaults, get json | ||
IP={"ip":"aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh"} | ||
INFO - Using ureq | ||
IP4="A.B.C.D" | ||
IP6="aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh" | ||
INFO - Using reqwest | ||
IP4="A.B.C.D" | ||
IP6="aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh" | ||
``` | ||
|
@@ -115,7 +97,7 @@ to your `Cargo.toml`: | |
|
||
``` toml | ||
[dependencies] | ||
ipify-rs = "0.2.0" | ||
ipify-rs = "0.5.0" | ||
``` | ||
then you can use it in your own crates. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters