setcap shell of linux added

This commit is contained in:
crusader 2018-08-30 01:42:33 +09:00
parent 51645626c7
commit 92370bffc2
4 changed files with 53 additions and 30 deletions

6
.linux_set_cap.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# chmod u+x ./.linux_set_cap.sh
# sudo chmod u+s ./.linux_set_cap.sh
setcap cap_net_raw,cap_net_admin=eip ./debug

6
.vscode/launch.json vendored
View File

@ -12,7 +12,10 @@
"program": "${workspaceRoot}/main.go", "program": "${workspaceRoot}/main.go",
"env": {}, "env": {},
"args": [], "args": [],
"showLog": true "showLog": true,
"linux": {
"preLaunchTask": "LinuxSetCap"
}
}, },
{ {
"name": "File Debug", "name": "File Debug",
@ -27,6 +30,5 @@
"args": [], "args": [],
"showLog": true "showLog": true
} }
] ]
} }

12
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "LinuxSetCap",
"type": "shell",
"command": "${workspaceRoot}/.linux_set_cap.sh"
}
]
}

View File

@ -2,6 +2,7 @@ package upnp
import ( import (
"fmt" "fmt"
"log"
omd "git.loafle.net/overflow/model/discovery" omd "git.loafle.net/overflow/model/discovery"
omu "git.loafle.net/overflow/model/util" omu "git.loafle.net/overflow/model/util"
@ -27,6 +28,8 @@ LOOP:
continue LOOP continue LOOP
} }
log.Print(rd)
discoverySession.AddHost(&omd.Host{ discoverySession.AddHost(&omd.Host{
MetaIPType: discoverySession.Zone().MetaIPType, MetaIPType: discoverySession.Zone().MetaIPType,
Name: rd.FriendlyName, Name: rd.FriendlyName,