Documentation ¶
Index ¶
- Constants
- Variables
- func ExportAddresses(s string) (matches []string)
- func ExportBankInfos(s string) (matches []string)
- func ExportCreditCards(s string) (matches []string)
- func ExportEmails(s string) (matches []string)
- func ExportIPs(s string) (matches []string)
- func ExportLinks(s string) (matches []string)
- func ExportPhones(s string) (matches []string)
- func ExportSSNs(s string) (matches []string)
- func ExportUUIDs(s string) (matches []string)
- func ExportVINs(s string) (matches []string)
- type Exporter
- type File
- type Matcher
- func Address() Matcher
- func All(funcs ...Matcher) Matcher
- func And(a, b Matcher) Matcher
- func Any(funcs ...Matcher) Matcher
- func AtLeastN(n int, funcs ...Matcher) Matcher
- func BankInfo() Matcher
- func CreditCard() Matcher
- func Email() Matcher
- func HaltLangDetect() Matcher
- func IP() Matcher
- func Link() Matcher
- func Not(f Matcher) Matcher
- func Or(a, b Matcher) Matcher
- func Phone() Matcher
- func SSN() Matcher
- func UUID() Matcher
- func VIN() Matcher
- type Metric
- type Rule
- type RuleSet
- type TestSettings
- type Tester
- func (t *Tester) AddNewFile(f string) error
- func (t *Tester) AddRecursiveDirectory(d string) error
- func (t *Tester) CalcAverages()
- func (t *Tester) PerformDetections(w *waiter.Waiter) []error
- func (t *Tester) PerformMatches(w *waiter.Waiter)
- func (t *Tester) SetDetection(s bool)
- func (t *Tester) SetFinder(s bool)
- func (t *Tester) Setup()
Constants ¶
const Version = `0.0.1`
Version represents the version of the PII library
Variables ¶
var ( // DefaultRuleSet provides a rule set of default PII rules DefaultRuleSet = RuleSet{ "phone_number": defaultPhoneRule, "ssn": defaultSSNRule, "email_address": defaultEmailRule, "ip_address": defaultIPRule, "credit_card": defaultCreditCardRule, "street_address": defaultAddressRule, "banking_info": defaultBankInfoRule, "uuid": defaultUUIDRule, "vin": defaultVINRule, } )
Functions ¶
func ExportAddresses ¶
ExportAddresses is not really working - disregard for the meantime.
func ExportBankInfos ¶
ExportBankInfos attempts to extract all bank info matches from a string
func ExportCreditCards ¶
ExportCreditCards attempts to extract all credit card numbers from a string
func ExportEmails ¶
ExportEmails attempts to extract all email address matches from a string
func ExportLinks ¶
ExportLinks attempts to grab all links and URLs from a string
func ExportPhones ¶
ExportPhones attempts to extract all phone matches from a string
func ExportSSNs ¶
ExportSSNs attempts to extract all SSN and India PAN number matches from a string
func ExportUUIDs ¶
ExportUUIDs attempts to extract all UUID matches from a string
func ExportVINs ¶
ExportVINs attempts to extract all VIN matches from a string
Types ¶
type File ¶
type File struct { sync.RWMutex Metric Filename string `json:"filename,omitempty" csv:"filename"` Path string `json:"path,omitempty" csv:"path"` Hits map[string]bool `json:"hits,omitempty" csv:"hits"` Matches map[string][]string `json:"matches,omitempty" csv:"matches"` Errored bool `json:"errored,omitempty" csv:"errored"` ErrorMessage string `json:"error_message,omitempty" csv:"error_message"` RuleCache []Rule `json:"-"` Data []byte `json:"-"` }
File defines a specific file that is to be tested
func (*File) DetectOnRule ¶
DetectOnRule performs a single detection on a file with a given rule
func (*File) FindOnRule ¶
FindOnRule performs a single export on a file with a given rule
type Matcher ¶
Matcher is an evaluation type
func Address ¶
func Address() Matcher
Address returns a matcher for identifying street address, po boxes, and zip codes
func BankInfo ¶
func BankInfo() Matcher
BankInfo returns a matcher for identifying either IBANs or US Routing #s
func CreditCard ¶
func CreditCard() Matcher
CreditCard returns a matcher for identifying major credit card numbers
func HaltLangDetect ¶
func HaltLangDetect() Matcher
HaltLangDetect is a special matcher for preventing language detection from running
func Link ¶
func Link() Matcher
Link returns a matcher for identifying URLs and links that are not emails
type Metric ¶
type Metric struct { DetectionLatencies map[string]float64 `json:"detection_latencies,omitempty" csv:"detection_latencies"` MatchLatencies map[string]float64 `json:"match_latencies,omitempty" csv:"match_latencies"` }
Metric is used to record the efficencies of matches
type Rule ¶
type Rule struct { Name string `json:"name,omitempty" csv:"name"` Description string `json:"description,omitempty" csv:"description"` Severity int `json:"severity,omitempty" csv:"severity"` Filter Matcher `json:"-"` Exporter Exporter `json:"-"` }
Rule defines a matching requirement
type TestSettings ¶
type TestSettings struct { DetectPII bool `json:"detect_pii,omitempty" csv:"detect_pii"` FindPII bool `json:"find_pii,omitempty" csv:"find_pii"` }
TestSettings are used to set the test harness settings
type Tester ¶
type Tester struct { TestSettings Metric Rules []Rule `json:"rules,omitempty" csv:"rules"` Files []*File `json:"files,omitempty" csv:"files"` }
Tester defines a test harness for assessment
func NewDefaultTester ¶
func NewDefaultTester() *Tester
NewDefaultTester creates a new default Test harness with all default rules included
func NewEmptyTester ¶
func NewEmptyTester() *Tester
NewEmptyTester returns an empty Test harness with no rules loaded
func NewSubsetRuleTester ¶
NewSubsetRuleTester returns a TestHarness with only a section of rules
func (*Tester) AddNewFile ¶
AddNewFile adds a new file to the test harness
func (*Tester) AddRecursiveDirectory ¶
AddRecursiveDirectory adds all files recursively in a directory to the test harness
func (*Tester) CalcAverages ¶
func (t *Tester) CalcAverages()
CalcAverages is used to calculate the averages of all the file matching metrics
func (*Tester) PerformDetections ¶
PerformDetections performs all detections against a given Test Harness
func (*Tester) PerformMatches ¶
PerformMatches performs all matches against a given Test Harness
func (*Tester) SetDetection ¶
SetDetection sets the tester's detect PII setting