sgfw

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2017 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STR_REDACTED = "[redacted]"
	STR_UNKNOWN  = "[uknown]"
)

Static strings for various usage

Variables

View Source
var FilterResultString = map[FilterResult]string{
	FILTER_DENY:   "DENY",
	FILTER_ALLOW:  "ALLOW",
	FILTER_PROMPT: "PROMPT",
}

FilterResultString converts a filter value ID to its string

FilterResultValue converts a filter value string to its ID

View Source
var FilterScopeString = map[FilterScope]string{
	APPLY_ONCE:    "ONCE",
	APPLY_SESSION: "SESSION",
	APPLY_FOREVER: "FOREVER",
}

FilterScopeString converts a filter scope ID to its string

FilterScopeString converts a filter scope string to its ID

View Source
var IDToLevel = func() map[string]int32 {
	m := make(map[string]int32)
	for k, v := range LevelToID {
		m[v] = k
	}
	return m
}()

Log level string conversion

View Source
var LevelToID = map[int32]string{
	int32(logging.ERROR):   "error",
	int32(logging.WARNING): "warning",
	int32(logging.NOTICE):  "notice",
	int32(logging.INFO):    "info",
	int32(logging.DEBUG):   "debug",
}

Log level conversion map

View Source
var RuleActionString = map[RuleAction]string{
	RULE_ACTION_DENY:  "DENY",
	RULE_ACTION_ALLOW: "ALLOW",
}

RuleActionString is used to get a string from an action id

RuleActionValue is used to get an action id using the action string

View Source
var RuleModeString = map[RuleMode]string{
	RULE_MODE_SESSION:   "SESSION",
	RULE_MODE_PERMANENT: "PERMANENT",
	RULE_MODE_SYSTEM:    "SYSTEM",
}

RuleModeString is used to get a rule mode string from its id

RuleModeValue converts a mode string to its id

Functions

func GetFilterScopeString

func GetFilterScopeString(scope FilterScope) string

GetFilterScopeString is used to safely return a filter scope string

func Main

func Main()

Types

type DbusRule

type DbusRule struct {
	ID     uint32
	App    string
	Path   string
	Verb   uint16
	Target string
	Mode   uint16
}

DbusRule struct of the rule passed to the dbus interface

type DesktopEntry

type DesktopEntry struct {
	// contains filtered or unexported fields
}

type FilterResult

type FilterResult uint16

FilterResult contains the filtering resulting action

const (
	FILTER_DENY FilterResult = iota
	FILTER_ALLOW
	FILTER_PROMPT
)

type FilterScope

type FilterScope uint16

FilterScope contains a filter's time scope

const (
	APPLY_ONCE FilterScope = iota
	APPLY_SESSION
	APPLY_FOREVER
)

func GetFilterScopeValue

func GetFilterScopeValue(scope string) FilterScope

GetFilterScopeValue is used to safely return a filter scope ID

type Firewall

type Firewall struct {
	// contains filtered or unexported fields
}

func (*Firewall) PolicyForPath

func (fw *Firewall) PolicyForPath(path string) *Policy

type FirewallConfigs

type FirewallConfigs struct {
	LogLevel        string
	LoggingLevel    logging.Level `toml:"-"`
	LogRedact       bool
	PromptExpanded  bool
	PromptExpert    bool
	DefaultAction   string
	DefaultActionID FilterScope `toml:"-"`
}
var FirewallConfig FirewallConfigs

type Policy

type Policy struct {
	// contains filtered or unexported fields
}

type Rule

type Rule struct {
	// contains filtered or unexported fields
}

func (*Rule) AddrString

func (r *Rule) AddrString(redact bool) string

func (*Rule) String

func (r *Rule) String() string

type RuleAction

type RuleAction uint16

RuleAction is the action to apply to a rule

const (
	RULE_ACTION_DENY RuleAction = iota
	RULE_ACTION_ALLOW
)

type RuleList

type RuleList []*Rule

type RuleMode

type RuleMode uint16

RuleMode contains the time scope of a rule

const (
	RULE_MODE_SESSION RuleMode = iota
	RULE_MODE_PERMANENT
	RULE_MODE_SYSTEM
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL