mirror of https://github.com/subgraph/fw-daemon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
723 B
39 lines
723 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/subgraph/oz"
|
|
)
|
|
|
|
var ozProfiles oz.Profiles
|
|
|
|
func init() {
|
|
c, err := oz.LoadConfig(oz.DefaultConfigPath)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Unable to read oz config...")
|
|
os.Exit(1)
|
|
}
|
|
p, err := oz.LoadProfiles(c.ProfileDir)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Unable to read oz profiles...")
|
|
os.Exit(1)
|
|
}
|
|
ozProfiles = p
|
|
}
|
|
|
|
func (fa *fwApp) initOZProfiles() {
|
|
for _, p := range ozProfiles {
|
|
// XXX: This actually should match against sgfw's opened sockets
|
|
switch {
|
|
case string(p.Networking.Nettype) == "host":
|
|
fallthrough
|
|
case len(p.Networking.Sockets) == 0:
|
|
continue
|
|
default:
|
|
fa.ozProfiles = append(fa.ozProfiles, p.Name)
|
|
}
|
|
}
|
|
}
|