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

62
.vscode/launch.json vendored
View File

@ -1,32 +1,34 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}/main.go",
"env": {},
"args": [],
"showLog": true
},
{
"name": "File Debug",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {},
"args": [],
"showLog": true
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}/main.go",
"env": {},
"args": [],
"showLog": true,
"linux": {
"preLaunchTask": "LinuxSetCap"
}
},
{
"name": "File Debug",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {},
"args": [],
"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 (
"fmt"
"log"
omd "git.loafle.net/overflow/model/discovery"
omu "git.loafle.net/overflow/model/util"
@ -27,6 +28,8 @@ LOOP:
continue LOOP
}
log.Print(rd)
discoverySession.AddHost(&omd.Host{
MetaIPType: discoverySession.Zone().MetaIPType,
Name: rd.FriendlyName,