checking in- needs some refinement then done
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/xml"
|
||||
"net"
|
||||
"net/netip"
|
||||
`time`
|
||||
|
||||
"go4.org/netipx"
|
||||
)
|
||||
@@ -100,6 +101,8 @@ type StructuredResults struct {
|
||||
Allocated []*ContainedResult `json:"subnets" xml:"subnets>subnet,omitempty" yaml:"Subnets"`
|
||||
// Unallocated contains subnets from Original that did not meet the splitting criteria or were left over from the split operation.
|
||||
Unallocated []*ContainedResult `json:"remaining" xml:"remaining>subnet,omitempty" yaml:"Remaining/Unallocated/Left Over,omitempty"`
|
||||
// Reservations contains any reserved addresses/prefixes within this set that are considered "special usage" and thus are likely to not be usable.
|
||||
Reservations []*IANAAddrNetResRecord `json:"reserved,omitempty" xml:"reserved>reservation,omitempty" yaml:"Matching Reserved Subnets,omitempty"`
|
||||
}
|
||||
|
||||
type SplitOpts struct {
|
||||
@@ -115,3 +118,76 @@ type ContainedResult struct {
|
||||
XMLName xml.Name `json:"-" yaml:"-" xml:"subnet"`
|
||||
Network *netip.Prefix `json:"net" xml:"net,attr,omitempty" yaml:"network,omitempty"`
|
||||
}
|
||||
|
||||
type IANADate time.Time
|
||||
|
||||
/*
|
||||
WHAT a PITA.
|
||||
IANA publishes their reservations in XML (YAY!) ... except they use inner XML all over the place
|
||||
in their text.
|
||||
So.
|
||||
*/
|
||||
type IANARegistry struct {
|
||||
XMLName xml.Name `json:"-" yaml:"-" xml:"registry"`
|
||||
Title string `json:"title" yaml:"Title" xml:"title"`
|
||||
Category string `json:"category,omitempty" yaml:"Category,omitempty" xml:"category,omitempty"`
|
||||
Created IANADate `json:"created" yaml:"Created" xml:"created"`
|
||||
Updated *IANADate `json:"updated,omitempty" yaml:"Updated,omitempty" xml:"updated,omitempty"`
|
||||
Notice *IANARegistryData `json:"notice" yaml:"Notice" xml:"registry"`
|
||||
Footnotes []*IANARegistryFootnote `json:"footnotes,omitempty" yaml:"Footnotes,omitempty" xml:"footnote,omitempty"`
|
||||
}
|
||||
|
||||
type IANAPrefix struct {
|
||||
// IANA may include multiple prefixes in the same record.
|
||||
Prefixes []*netip.Prefix `json:"prefix" yaml:"prefix" xml:"prefixes>prefix,attr"`
|
||||
References []*IANARef `json:"refs,omitempty" yaml:"References,omitempty" xml:"refs,omitempty"`
|
||||
}
|
||||
|
||||
type IANAString struct {
|
||||
Text string `json:"text" yaml:"Text" xml:"text"`
|
||||
References []*IANARef `json:"refs" yaml:"References" xml:"references"`
|
||||
}
|
||||
|
||||
type IANARegistryFootnote struct {
|
||||
XMLName xml.Name `json:"-" yaml:"-" xml:"footnote"`
|
||||
ReferenceIdx uint `json:"ref" yaml:"Reference Index/ID" xml:"anchor,attr"`
|
||||
Note *IANAString `json:"note" yaml:"Note" xml:"node"`
|
||||
}
|
||||
|
||||
type IANARegistryData struct {
|
||||
XMLName xml.Name `json:"-" yaml:"-" xml:"registry"`
|
||||
ID string `json:"id" yaml:"ID" xml:"id,attr"`
|
||||
Title string `json:"title" yaml:"Title" xml:"title"`
|
||||
Refs []*IANARef `json:"refs" yaml:"Referencess" xml:"xref"`
|
||||
Rule string `json:"rule" yaml:"Registration Rule" xml:"registration_rule"`
|
||||
Note *IANAString `json:"note,omitempty" yaml:"Note,omitempty" xml:"note,omitempty"`
|
||||
Records []*IANAAddrNetResRecord `json:"records,omitempty" yaml:"Records,omitempty" xml:"record,omitempty"`
|
||||
}
|
||||
|
||||
// IANARef is used to hold references to RFCs etc.
|
||||
type IANARef struct {
|
||||
XMLName xml.Name `json:"-" yaml:"-" xml:"xref"`
|
||||
Type string `json:"type" yaml:"Type" xml:"type,attr"`
|
||||
// TODO: This may have inner XML.
|
||||
Reference string `json:"ref" yaml:"Reference ID" xml:"data,attr"`
|
||||
}
|
||||
|
||||
type IANABool struct {
|
||||
Applicable *bool `json:"applicable,omitempty" yaml:"Is Applicable,omitempty" xml:"applicable,attr,omitempty"`
|
||||
Evaluated *bool `json:"bool,omitempty" yaml:"As Boolean,omitempty" xml:"evaluated,attr,omitempty"`
|
||||
}
|
||||
type IANAAddrNetResRecord struct {
|
||||
XMLName xml.Name `json:"-" yaml:"-" xml:"record"`
|
||||
Updated *IANADate `json:"updated,omitempty" xml:"updated,omitempty"`
|
||||
Networks *IANAPrefix `json:"net,omitempty" yaml:"Address/Network,omitempty" xml:"address,omitempty"`
|
||||
Name string `json:"name" yaml:"Name" xml:"name"`
|
||||
// TODO: This has inner XML.
|
||||
Spec *IANAString `json:"spec" yaml:"Spec" xml:"spec"`
|
||||
Allocation IANADate `json:"alloc" yaml:"Allocation Month" xml:"allocation"`
|
||||
Termination *IANADate `json:"term,omitempty" yaml:"Termination,omitempty" xml:"termination,omitempty"`
|
||||
Source *IANABool `json:"source,omitempty" yaml:"Is Source,omitempty" xml:"source,omitempty"`
|
||||
Dest *IANABool `json:"dest,omitempty" yaml:"Is Destination,omitempty" xml:"dest,omitempty"`
|
||||
Forwardable *IANABool `json:"forwardable,omitempty" yaml:"Is Forwardable,omitempty" xml:"forwardable,omitempty"`
|
||||
GlobalReach *IANABool `json:"global,omitempty" yaml:"Is Globally Reachable,omitempty" xml:"global,omitempty"`
|
||||
ProtoReserved *IANABool `json:"reserved,omitempty" yaml:"Is Reserved by Protocol,omitempty" xml:"reserved,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user