Class: Mt::Wall::Model::AddressObject
- Inherits:
-
Data
- Object
- Data
- Mt::Wall::Model::AddressObject
- Defined in:
- lib/mt/wall/model/address_object.rb
Overview
A named firewall object: a label bound to one or more IP addresses or CIDR subnets. Compiles to entries in a RouterOS ‘/ip firewall address-list`. The same address may belong to many objects (one IP -> many list memberships), which is native to address-lists.
ADDRESS FAMILY (IPv4 vs IPv6) is INFERRED per address via the stdlib ‘IPAddr` — there are no separate v4/v6 verbs and a single object MAY hold a mix of families. The Compiler partitions the addresses by family so that IPv4 entries land in `/ip/firewall/address-list` and IPv6 entries in `/ipv6/firewall/address-list` (see Compiler / DesiredState).
VALIDATION (fail-fast at the DSL/model boundary): ‘name` must match the strict charset `A+z`; every entry in `addresses` must be a valid single address, a CIDR subnet, OR an IP RANGE (`10.0.0.1-10.0.0.10`, both endpoints the same family) — each form parses via `IPAddr` (this also neutralizes .rsc / JSON injection). FQDN address-list entries are OUT OF SCOPE for v1 (future). An object with NO addresses is an error.
Instance Attribute Summary collapse
-
#addresses ⇒ Object
readonly
Returns the value of attribute addresses.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name:, addresses: [], comment: nil) ⇒ AddressObject
constructor
A new instance of AddressObject.
Constructor Details
#initialize(name:, addresses: [], comment: nil) ⇒ AddressObject
Returns a new instance of AddressObject.
29 30 31 |
# File 'lib/mt/wall/model/address_object.rb', line 29 def initialize(name:, addresses: [], comment: nil) super(name: name, addresses: Array(addresses), comment: comment) end |
Instance Attribute Details
#addresses ⇒ Object (readonly)
Returns the value of attribute addresses
28 29 30 31 32 |
# File 'lib/mt/wall/model/address_object.rb', line 28 AddressObject = Data.define(:name, :addresses, :comment) do def initialize(name:, addresses: [], comment: nil) super(name: name, addresses: Array(addresses), comment: comment) end end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment
28 29 30 31 32 |
# File 'lib/mt/wall/model/address_object.rb', line 28 AddressObject = Data.define(:name, :addresses, :comment) do def initialize(name:, addresses: [], comment: nil) super(name: name, addresses: Array(addresses), comment: comment) end end |
#name ⇒ Object (readonly)
Returns the value of attribute name
28 29 30 31 32 |
# File 'lib/mt/wall/model/address_object.rb', line 28 AddressObject = Data.define(:name, :addresses, :comment) do def initialize(name:, addresses: [], comment: nil) super(name: name, addresses: Array(addresses), comment: comment) end end |