mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-07 23:27:46 +00:00
Add root privilege requirement notice
This commit is contained in:
parent
1a4a8c4c16
commit
e4d4e0965e
1 changed files with 7 additions and 1 deletions
|
@ -145,8 +145,14 @@ impl Setup {
|
||||||
|
|
||||||
pub fn setup(&mut self) -> Result<(), Error> {
|
pub fn setup(&mut self) -> Result<(), Error> {
|
||||||
self.set_up = true;
|
self.set_up = true;
|
||||||
let tun_name = self.tun.clone();
|
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
if libc::getuid() != 0 {
|
||||||
|
return Err("Automatic setup requires root privileges".into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let tun_name = self.tun.clone();
|
||||||
// TODO: This is not optimal.
|
// TODO: This is not optimal.
|
||||||
ctrlc::set_handler(move || {
|
ctrlc::set_handler(move || {
|
||||||
Self::shutdown(tun_name.clone());
|
Self::shutdown(tun_name.clone());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue