Documentation
¶
Index ¶
- func Compile(yaml string) (*aitm.Phishlet, error)
- func Load(path string) (*aitm.Phishlet, error)
- type Compiler
- type Resolver
- func (r *Resolver) Get(name string) *aitm.ConfiguredPhishlet
- func (r *Resolver) InvalidateLures()
- func (r *Resolver) LoadLuresFromDB() error
- func (r *Resolver) OwnerOf(hostname string) string
- func (r *Resolver) Register(cp *aitm.ConfiguredPhishlet)
- func (r *Resolver) ResolveHostname(hostname, urlPath string) (*aitm.ConfiguredPhishlet, *aitm.Lure, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compiler ¶ added in v0.3.0
type Compiler struct{}
Compiler satisfies the phishletCompiler interface defined in the aitm package.
type Resolver ¶ added in v0.3.0
type Resolver struct {
// contains filtered or unexported fields
}
Resolver maps request hostnames to their configured phishlet and lure. All state is held in memory. Register must be called whenever a phishlet is enabled or its config changes. InvalidateLures must be called whenever a lure is created, updated, or deleted.
func NewResolver ¶ added in v0.3.0
func (*Resolver) Get ¶ added in v0.3.0
func (r *Resolver) Get(name string) *aitm.ConfiguredPhishlet
Get returns the registered configured phishlet by name, or nil if not registered.
func (*Resolver) InvalidateLures ¶ added in v0.3.0
func (r *Resolver) InvalidateLures()
InvalidateLures reloads the lure cache from the store. Call after any lure mutation. On store error the stale cache is kept so in-flight requests are not disrupted.
func (*Resolver) LoadLuresFromDB ¶ added in v0.3.0
LoadLuresFromDB populates the in-memory lure cache from the store. Call once at startup before serving requests.
func (*Resolver) OwnerOf ¶ added in v0.3.0
OwnerOf returns the name of the enabled phishlet that owns hostname, or "" if no phishlet is registered for it.
func (*Resolver) Register ¶ added in v0.3.0
func (r *Resolver) Register(cp *aitm.ConfiguredPhishlet)
Register stores cp in both indexes. If cp is enabled and has a non-empty hostname it becomes reachable by hostname. Replaces any previously registered entry with the same name, cleaning up the old hostname index entry if the hostname changed.
func (*Resolver) ResolveHostname ¶ added in v0.3.0
func (r *Resolver) ResolveHostname(hostname, urlPath string) (*aitm.ConfiguredPhishlet, *aitm.Lure, error)
ResolveHostname returns the configured phishlet and best-matching lure for a request. When multiple lures share a phishlet, the longest path prefix wins.