implemented pledge and unveil on openbsd
This commit is contained in:
parent
3f1752e961
commit
0c4376ec32
205 changed files with 19126 additions and 4610 deletions
|
|
@ -38,6 +38,31 @@ func TryParse(url string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Paths(url string) (paths []string) {
|
||||
u, err := neturl.Parse(url)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "file":
|
||||
paths = append(paths, u.Path)
|
||||
case "sftp":
|
||||
q, err := neturl.ParseQuery(u.RawQuery)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
known, err := sftp.KnownHosts(q)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
paths = append(paths, known)
|
||||
if key := q.Get(sftp.KeyParam); key != "" {
|
||||
paths = append(paths, key)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func FS(url string, key []byte, re *regexp.Regexp, block bool) (provider.FS, error) {
|
||||
u, err := neturl.Parse(url)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue