winreg-rs
winreg-rs copied to clipboard
Don't set the internet Settings correctly
Hello,
I want to set windows proxy as "socks=127.0.0.1" and port 1080, but it will be "http://socks=127.0.0.1". How to fix it?
let (key, _) = RegKey::predef(HKEY_CURRENT_USER).create_subkey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")?;
if isOpen{
key.set_value("ProxyEnable", &1u32)?;
key.set_value("ProxyServer", &format!("{}:{}", "socks=127.0.0.1", 1080))?;
key.set_value("ProxyOverride", &"<local>")?;
}else{
key.set_value("ProxyEnable", &0u32)?;
}
I don't understand the question. Your code does exactly what it should and sets the proxy settings like this:
"http://socks=127.0.0.1/"
is this what appears in the address string of the browser?
yes, but in the socks address box is "http://socks=127.0.0.1", the prefix "http://" will be added auto. my os is windows 11.
btw, "http://socks=127.0.0.1" don't work, "socks=127.0.0.1" work well.