this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1 from mbStavola/add-ipecho

Add ipecho script

authored by

Matt Freitas-Stavola and committed by
GitHub
3c130e51 86d74dc6

+23
+23
ipecho
··· 1 + #!/usr/bin/env -S cargo eval -- 2 + 3 + //! ```cargo 4 + //! [dependencies] 5 + //! reqwest = { version = "0.11.3", features = ["blocking"] } 6 + //! ``` 7 + 8 + use reqwest::blocking::Client; 9 + 10 + fn main() { 11 + let client = Client::new(); 12 + let res = client 13 + .get("https://ipecho.net/plain") 14 + .send() 15 + .expect("unexpected error while trying to reach ipecho.net"); 16 + 17 + if res.status() != 200 { 18 + panic!("Unexpected status code {}", res.status()); 19 + } 20 + 21 + let ip = res.text().expect("should be able to deserialize body"); 22 + println!("{}", ip); 23 + }