~jplatte/rust-libproxy

ref: refs/heads/master rust-libproxy/examples/proxy.rs -rw-r--r-- 446 bytes View raw
3375daa9 — Jonas Platte Update repository url to git.sr.ht 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Reimplementation of the proxy command line utitlity that comes with libproxy.

extern crate libproxy;

use libproxy::ProxyFactory;

fn main() {
    let mut args = std::env::args();
    if args.len() != 2 {
        println!("Usage: proxy <url>");
        return;
    }

    let factory = ProxyFactory::new().unwrap();

    for proxy in factory.get_proxies(&args.nth(1).unwrap()).unwrap() {
        print!("{} ", proxy);
    }
    println!();
}