filter

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PolicyList

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

PolicyList represents a list of policies

func NewPolicyList

func NewPolicyList() PolicyList

NewPolicyList creates a new PolicyList

func (*PolicyList) GetAuthenticatedPolicyAddresses

func (p *PolicyList) GetAuthenticatedPolicyAddresses() (map[common.AddrString]SievePolicyJSONConfig, error)

func (*PolicyList) GetListenerAddresses

func (p *PolicyList) GetListenerAddresses() []common.AddrString

func (*PolicyList) ListenerExists

func (p *PolicyList) ListenerExists(policy *SievePolicyJSONConfig) bool

func (*PolicyList) LoadFilterFile

func (p *PolicyList) LoadFilterFile(filePath string) (*SievePolicyJSONConfig, error)

LoadFilterFile loads the specified filter file

func (*PolicyList) LoadFilters

func (p *PolicyList) LoadFilters(directoryPath string) error

LoadFilters loads filter files

type Sieve

type Sieve struct {
	Allowed             []string
	AllowedPrefixes     []string
	Regexes             []string
	ScrubRegexes        map[string]string
	Replacements        map[string]string
	ReplacementPrefixes map[string]string
}

Sieve represents unidirectional message filtration

func NewSieve

func NewSieve(allowed, allowedPrefixes, regexes []string, scrubs, replacements, replacementPrefixes map[string]string) *Sieve

NewSieve creates a new Sieve

func (*Sieve) Filter

func (s *Sieve) Filter(message string) string

Filter performs filtration on the message Filter(message) -> outputMessage If an empty string is returned this means the message was denied because our default policy is deny if there is no allow or replace rule specified.

type SievePolicyJSONConfig

type SievePolicyJSONConfig struct {
	Name        string
	AuthNetAddr string `json:"AuthNetAddr"`
	AuthAddr    string `json:"AuthAddr"`

	ClientAllowed             []string          `json:"client-allowed"`
	ClientAllowedPrefixes     []string          `json:"client-allowed-prefixes"`
	ClientRegexes             []string          `json:"client-regex"`
	ClientScrubRegexes        map[string]string `json:"client-scrub-regexes"` // not likely to be used
	ClientReplacements        map[string]string `json:"client-replacements"`
	ClientReplacementPrefixes map[string]string `json:"client-replacement-prefixes"`

	ServerAllowed             []string          `json:"server-allowed"`
	ServerAllowedPrefixes     []string          `json:"server-allowed-prefixes"`
	ServerRegexes             []string          `json:"server-regexes"`
	ServerScrubRegexes        map[string]string `json:"server-scrub-regexes"`
	ServerReplacements        map[string]string `json:"server-replacements"`
	ServerReplacementPrefixes map[string]string `json:"server-replacement-prefixes"`

	OzApp              string `json:"oz-app":`
	OzAppForwarderName string `json:"oz-app-forwarder-name":`
	OzForwardOnion     bool   `json:"request-oz-onion-forwarder":`
}

SievePolicyJSONConfig defines the bidirectional filtration policy

func (*SievePolicyJSONConfig) GetSieves

func (p *SievePolicyJSONConfig) GetSieves() (*Sieve, *Sieve)

GetSieves -> client sieve, server sieve

Jump to

Keyboard shortcuts

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