Documentation
¶
Index ¶
- func BuildExtensionMatchersFromRules(rules []types.Rule)
- func BuildFileMatchersFromRules(rules []types.Rule)
- func ClearExtensionMatchers()
- func ClearFileMatchers()
- func MatchExtensions(files []types.File) map[string][]string
- func MatchFiles(files []types.File, currentPath, basePath string) map[string][]string
- func RegisterExtensionMatcher(matcher ExtensionMatcher)
- func RegisterFileMatcher(matcher FileMatcher)
- type CompiledContentMatcher
- type ContentMatcherRegistry
- func (r *ContentMatcherRegistry) BuildFromRules(rules []types.Rule) error
- func (r *ContentMatcherRegistry) HasContentMatchers(extension string) bool
- func (r *ContentMatcherRegistry) HasFileMatchers(filename string) bool
- func (r *ContentMatcherRegistry) MatchContent(extension string, content string) map[string][]string
- func (r *ContentMatcherRegistry) MatchFileContent(filename string, content string) map[string][]string
- func (r *ContentMatcherRegistry) RegisterContentType(matcher ContentTypeMatcher)
- type ContentTypeMatcher
- type ContentTypeRegistry
- func (r *ContentTypeRegistry) Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
- func (r *ContentTypeRegistry) Get(contentType string) ContentTypeMatcher
- func (r *ContentTypeRegistry) Register(matcher ContentTypeMatcher)
- func (r *ContentTypeRegistry) SupportedTypes() []string
- type ExtensionMatcher
- type FileMatcher
- type JSONPathContentMatcher
- type RegexContentMatcher
- type XMLPathContentMatcher
- type YAMLPathContentMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildExtensionMatchersFromRules ¶
BuildExtensionMatchersFromRules creates extension matchers from rules
func BuildFileMatchersFromRules ¶
BuildFileMatchersFromRules creates file matchers from rules
func ClearExtensionMatchers ¶
func ClearExtensionMatchers()
ClearExtensionMatchers clears all registered extension matchers (useful for testing)
func ClearFileMatchers ¶
func ClearFileMatchers()
ClearFileMatchers clears all registered file matchers (useful for testing)
func MatchExtensions ¶
MatchExtensions runs all extension matchers and returns matched techs Returns a map of tech -> reasons
func MatchFiles ¶
MatchFiles runs all file matchers and returns matched techs Returns a map of tech -> reasons
func RegisterExtensionMatcher ¶
func RegisterExtensionMatcher(matcher ExtensionMatcher)
RegisterExtensionMatcher adds an extension matcher to the registry
func RegisterFileMatcher ¶
func RegisterFileMatcher(matcher FileMatcher)
RegisterFileMatcher adds a file matcher to the registry
Types ¶
type CompiledContentMatcher ¶
type CompiledContentMatcher interface {
// Match checks if the content matches, returns (matched, reason)
Match(content string) (bool, string)
// Tech returns the technology this matcher detects
Tech() string
}
CompiledContentMatcher is a pre-compiled matcher ready for matching
type ContentMatcherRegistry ¶
type ContentMatcherRegistry struct {
// contains filtered or unexported fields
}
ContentMatcherRegistry manages compiled content matchers
func NewContentMatcherRegistry ¶
func NewContentMatcherRegistry() *ContentMatcherRegistry
NewContentMatcherRegistry creates a new content matcher registry
func (*ContentMatcherRegistry) BuildFromRules ¶
func (r *ContentMatcherRegistry) BuildFromRules(rules []types.Rule) error
BuildFromRules compiles content patterns from rules
func (*ContentMatcherRegistry) HasContentMatchers ¶
func (r *ContentMatcherRegistry) HasContentMatchers(extension string) bool
HasContentMatchers checks if there are any content matchers for the given extension
func (*ContentMatcherRegistry) HasFileMatchers ¶
func (r *ContentMatcherRegistry) HasFileMatchers(filename string) bool
HasFileMatchers checks if there are any content matchers for the given filename
func (*ContentMatcherRegistry) MatchContent ¶
func (r *ContentMatcherRegistry) MatchContent(extension string, content string) map[string][]string
MatchContent checks if content matches any patterns for the given extension Returns map of tech -> reasons Stops after first match per tech (rule is satisfied with one pattern match)
func (*ContentMatcherRegistry) MatchFileContent ¶
func (r *ContentMatcherRegistry) MatchFileContent(filename string, content string) map[string][]string
MatchFileContent checks if content matches any patterns for the given filename Returns map of tech -> reasons
func (*ContentMatcherRegistry) RegisterContentType ¶
func (r *ContentMatcherRegistry) RegisterContentType(matcher ContentTypeMatcher)
RegisterContentType adds a custom content type matcher
type ContentTypeMatcher ¶
type ContentTypeMatcher interface {
// Type returns the content type identifier (e.g., "regex", "json-path", "json-schema")
Type() string
// Compile prepares the matcher from a content rule, returns error if invalid
Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
}
ContentTypeMatcher is the interface for all content type matchers Implement this interface to add new content matching types
type ContentTypeRegistry ¶
type ContentTypeRegistry struct {
// contains filtered or unexported fields
}
ContentTypeRegistry manages registered content type matchers
func NewContentTypeRegistry ¶
func NewContentTypeRegistry() *ContentTypeRegistry
NewContentTypeRegistry creates a new registry with default matchers
func (*ContentTypeRegistry) Compile ¶
func (r *ContentTypeRegistry) Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
Compile compiles a content rule using the appropriate matcher
func (*ContentTypeRegistry) Get ¶
func (r *ContentTypeRegistry) Get(contentType string) ContentTypeMatcher
Get returns the matcher for a given type, or nil if not found
func (*ContentTypeRegistry) Register ¶
func (r *ContentTypeRegistry) Register(matcher ContentTypeMatcher)
Register adds a content type matcher to the registry
func (*ContentTypeRegistry) SupportedTypes ¶
func (r *ContentTypeRegistry) SupportedTypes() []string
SupportedTypes returns all registered content type names
type ExtensionMatcher ¶
ExtensionMatcher is a function that matches file extensions and returns the matched tech
func GetExtensionMatchers ¶
func GetExtensionMatchers() []ExtensionMatcher
GetExtensionMatchers returns all registered extension matchers
type FileMatcher ¶
type FileMatcher func(files []types.File, currentPath, basePath string) (tech string, matchedFile string, matched bool)
FileMatcher is a function that matches files and returns the matched tech and file
func GetFileMatchers ¶
func GetFileMatchers() []FileMatcher
GetFileMatchers returns all registered file matchers
type JSONPathContentMatcher ¶
type JSONPathContentMatcher struct{}
JSONPathContentMatcher handles JSON path matching
func (*JSONPathContentMatcher) Compile ¶
func (m *JSONPathContentMatcher) Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
func (*JSONPathContentMatcher) Type ¶
func (m *JSONPathContentMatcher) Type() string
type RegexContentMatcher ¶
type RegexContentMatcher struct{}
RegexContentMatcher handles regex-based content matching (default type)
func (*RegexContentMatcher) Compile ¶
func (m *RegexContentMatcher) Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
func (*RegexContentMatcher) Type ¶
func (m *RegexContentMatcher) Type() string
type XMLPathContentMatcher ¶
type XMLPathContentMatcher struct{}
XMLPathContentMatcher handles XML XPath-like content matching
func (*XMLPathContentMatcher) Compile ¶
func (m *XMLPathContentMatcher) Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
func (*XMLPathContentMatcher) Type ¶
func (m *XMLPathContentMatcher) Type() string
type YAMLPathContentMatcher ¶
type YAMLPathContentMatcher struct{}
YAMLPathContentMatcher handles YAML path-based content matching Supports simple dot-notation paths like "$.name", "$.services.web"
func (*YAMLPathContentMatcher) Compile ¶
func (m *YAMLPathContentMatcher) Compile(rule types.ContentRule, tech string) (CompiledContentMatcher, error)
func (*YAMLPathContentMatcher) Type ¶
func (m *YAMLPathContentMatcher) Type() string