systemproxy 0.3.6

A library for set/get system proxy. Supports Windows, macOS and linux (via gsettings).
Documentation
#[cfg(test)]
mod tests {
    use serial_test::serial;
    use systemproxy::{Autoproxy, SystemProxy};

    #[test]
    fn test_sys_support() {
        assert!(SystemProxy::is_support());
    }

    #[test]
    fn test_auto_support() {
        assert!(Autoproxy::is_support());
    }

    #[test]
    fn test_sys_get() {
        SystemProxy::get_system_proxy().unwrap();
    }

    #[test]
    fn test_auto_get() {
        Autoproxy::get_auto_proxy().unwrap();
    }

    #[test]
    #[serial]
    fn test_system_enable() {
        let mut sys_proxy = SystemProxy {
            enable: true,
            host: "127.0.0.1".into(),
            port: 9090,
            #[cfg(windows)]
            bypass_local: true,
            ..Default::default()
        };
        sys_proxy.set_system_proxy().unwrap();

        let cur_proxy = SystemProxy::get_system_proxy().unwrap();

        assert_eq!(cur_proxy, sys_proxy);

        sys_proxy.enable = false;
        #[cfg(windows)]
        {
            sys_proxy.bypass_local = false;
        }
        sys_proxy.set_system_proxy().unwrap();

        let current = SystemProxy::get_system_proxy().unwrap();
        assert_eq!(current, sys_proxy);
    }

    #[test]
    #[serial]
    fn test_auto_enable() {
        let mut autoproxy = Autoproxy {
            enable: true,
            url: "http://127.0.0.1:1234/".into(),
        };
        autoproxy.set_auto_proxy().unwrap();

        let cur_proxy = Autoproxy::get_auto_proxy().unwrap();

        assert_eq!(cur_proxy, autoproxy);

        autoproxy.enable = false;
        autoproxy.url = "".into();
        autoproxy.set_auto_proxy().unwrap();

        let current = Autoproxy::get_auto_proxy().unwrap();
        assert_eq!(current, autoproxy);
    }
}