Class: MailAuth::Spf::Budget
- Inherits:
-
Object
- Object
- MailAuth::Spf::Budget
- Defined in:
- lib/mailauth/spf/budget.rb
Overview
RFC 7208 ยง4.6.4's allowance per evaluation, spent one query at a time.
Ten lookups caps a stranger's record chaining includes forever; two
voids catches a record whose targets mostly don't exist.
Constant Summary collapse
- MAX_LOOKUPS =
10- MAX_VOID_LOOKUPS =
2- MAX_NAME_LENGTH =
253- MAX_LABEL_LENGTH =
63
Instance Attribute Summary collapse
-
#lookups ⇒ Object
readonly
Returns the value of attribute lookups.
Instance Method Summary collapse
- #a(name) ⇒ Object
- #aaaa(name) ⇒ Object
-
#branch ⇒ Object
mxandptrfan out into an address lookup per name. -
#initialize(resolver, charging: true) ⇒ Budget
constructor
charging: falselets the opening record fetch through free: it belongs to no mechanism, so nobody is billed for it. - #mx(name) ⇒ Object
-
#ptr(address) ⇒ Object
Takes the client address, not a name: the reverse zone is the resolver's business.
- #txt(name) ⇒ Object
Constructor Details
#initialize(resolver, charging: true) ⇒ Budget
charging: false lets the opening record fetch through free: it belongs
to no mechanism, so nobody is billed for it.
16 17 18 19 20 21 |
# File 'lib/mailauth/spf/budget.rb', line 16 def initialize(resolver, charging: true) @resolver = resolver @charging = charging @lookups = 0 @voids = 0 end |
Instance Attribute Details
#lookups ⇒ Object (readonly)
Returns the value of attribute lookups.
12 13 14 |
# File 'lib/mailauth/spf/budget.rb', line 12 def lookups @lookups end |
Instance Method Details
#a(name) ⇒ Object
27 28 29 |
# File 'lib/mailauth/spf/budget.rb', line 27 def a(name) query(:a, name) end |
#aaaa(name) ⇒ Object
31 32 33 |
# File 'lib/mailauth/spf/budget.rb', line 31 def aaaa(name) query(:aaaa, name) end |
#branch ⇒ Object
mx and ptr fan out into an address lookup per name. RFC 7208 bounds
that separately, so it gets its own allowance.
47 48 49 |
# File 'lib/mailauth/spf/budget.rb', line 47 def branch Budget.new(@resolver) end |
#mx(name) ⇒ Object
35 36 37 |
# File 'lib/mailauth/spf/budget.rb', line 35 def mx(name) query(:mx, name) end |
#ptr(address) ⇒ Object
Takes the client address, not a name: the reverse zone is the resolver's business.
41 42 43 |
# File 'lib/mailauth/spf/budget.rb', line 41 def ptr(address) resolve(:ptr, address) end |
#txt(name) ⇒ Object
23 24 25 |
# File 'lib/mailauth/spf/budget.rb', line 23 def txt(name) query(:txt, name) end |