1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

Replace -allow-connect and -allow-accept with -allow-net

This commit is contained in:
Ryan Dahl 2018-05-30 17:00:32 +02:00
parent 871a8e05ec
commit 98be591b3c
2 changed files with 8 additions and 12 deletions

View file

@ -31,8 +31,8 @@ func Fetch(id int32, targetUrl string) []byte {
FetchResId: id,
}
if !Perms.Connect {
resMsg.Error = "Permission to connect denied."
if !Perms.Net {
resMsg.Error = "Network access denied."
PubMsg("fetch", resMsg)
return
}

16
main.go
View file

@ -15,27 +15,23 @@ var flagV8Options = flag.Bool("v8-options", false, "Print V8 command line option
var flagDebug = flag.Bool("debug", false, "Enable debug output.")
var flagGoProf = flag.String("goprof", "", "Write golang cpu profile to file.")
var flagAllowWrite = flag.Bool("allow-write", false,
"Allow program to write to the fs.")
var flagAllowConnect = flag.Bool("allow-connect", false,
"Allow program to connect to other network addresses.")
var flagAllowAccept = flag.Bool("allow-accept", false,
"Allow program to accept connections.")
var flagAllowRead = flag.Bool("allow-read", true,
"Allow program to read file system.")
var flagAllowWrite = flag.Bool("allow-write", false,
"Allow program to write to the fs.")
var flagAllowNet = flag.Bool("allow-net", false,
"Allow program to make network connection.")
var Perms struct {
FsRead bool
FsWrite bool
Connect bool
Accept bool
Net bool
}
func setPerms() {
Perms.FsRead = *flagAllowRead
Perms.FsWrite = *flagAllowWrite
Perms.Connect = *flagAllowConnect
Perms.Accept = *flagAllowAccept
Perms.Net = *flagAllowNet
}
func stringAsset(path string) string {