Documentation
¶
Overview ¶
Package cap parses, validates, and encodes OASIS Common Alerting Protocol Version 1.2 messages, including CAP-CP 1.0. It also provides geometry helpers and enveloped XML signature verification.
Index ¶
- Variables
- func MarshalCAP(alert *Alert) ([]byte, error)
- func SignatureCertificates(data []byte) ([]*x509.Certificate, error)
- func VerifySignature(data []byte, options SignatureOptions) (*x509.Certificate, error)
- type Alert
- type Algorithm
- type Area
- type Category
- type Certainty
- func (t Certainty) MarshalJSON() ([]byte, error)
- func (t Certainty) MarshalXML(encoder *xml.Encoder, elem xml.StartElement) error
- func (t Certainty) String() string
- func (t *Certainty) UnmarshalJSON(buff []byte) error
- func (t *Certainty) UnmarshalXML(decoder *xml.Decoder, elem xml.StartElement) error
- type CircleGeometry
- type Coordinate
- type DateTime
- func (t DateTime) IsZero() bool
- func (t DateTime) MarshalJSON() ([]byte, error)
- func (t DateTime) MarshalXML(encoder *xml.Encoder, elem xml.StartElement) error
- func (t DateTime) String() string
- func (t DateTime) Time() time.Time
- func (t *DateTime) UnmarshalJSON(buff []byte) error
- func (t *DateTime) UnmarshalXML(decoder *xml.Decoder, elem xml.StartElement) error
- type Diagnostic
- type DiagnosticLevel
- type Diagnostics
- type Extension
- type Info
- type KeyValue
- type List
- func (t List) Coordinates() ([]Coordinate, error)
- func (t List) MarshalJSON() ([]byte, error)
- func (t List) MarshalXML(encoder *xml.Encoder, elem xml.StartElement) error
- func (t List) String() string
- func (t *List) UnmarshalJSON(buff []byte) error
- func (t *List) UnmarshalXML(decoder *xml.Decoder, elem xml.StartElement) error
- func (t List) Values() []string
- type MsgType
- type Reference
- type Resource
- type ResponseType
- func (t ResponseType) MarshalJSON() ([]byte, error)
- func (t ResponseType) MarshalXML(encoder *xml.Encoder, elem xml.StartElement) error
- func (t ResponseType) String() string
- func (t *ResponseType) UnmarshalJSON(buff []byte) error
- func (t *ResponseType) UnmarshalXML(decoder *xml.Decoder, elem xml.StartElement) error
- type Scope
- type Severity
- type Signature
- type SignatureOptions
- type SignatureProperty
- type SignedInfo
- type Status
- type Urgency
- type ValidationError
- type XCValue
Constants ¶
This section is empty.
Variables ¶
var CategoryMapping = map[string]Category{ "Geo": CategoryGeo, "Met": CategoryMet, "Safety": CategorySafety, "Security": CategorySecurity, "Rescue": CategoryRescue, "Fire": CategoryFire, "Health": CategoryHealth, "Env": CategoryEnv, "Transport": CategoryTransport, "Infra": CategoryInfra, "CBRNE": CategoryCBRNE, "Other": CategoryOther, }
CategoryMapping maps CAP category values to Category constants. Callers must not modify it.
var CertaintyMapping = map[string]Certainty{ "Observed": CertaintyObserved, "Likely": CertaintyLikely, "Possible": CertaintyPossible, "Unlikely": CertaintyUnlikely, "Unknown": CertaintyUnknown, }
CertaintyMapping maps CAP certainty values to Certainty constants. Callers must not modify it.
var MsgTypeMapping = map[string]MsgType{ "Alert": MsgTypeAlert, "Update": MsgTypeUpdate, "Cancel": MsgTypeCancel, "Ack": MsgTypeAck, "Error": MsgTypeError, }
MsgTypeMapping maps CAP message type values to MsgType constants. Callers must not modify it.
var ResponseTypeMapping = map[string]ResponseType{ "Shelter": ResponseTypeShelter, "Evacuate": ResponseTypeEvacuate, "Prepare": ResponseTypePrepare, "Execute": ResponseTypeExecute, "Avoid": ResponseTypeAvoid, "Monitor": ResponseTypeMonitor, "Assess": ResponseTypeAssess, "AllClear": ResponseTypeAllClear, "None": ResponseTypeNone, }
ResponseTypeMapping maps CAP response values to ResponseType constants. Callers must not modify it.
var ScopeMapping = map[string]Scope{ "Public": ScopePublic, "Restricted": ScopeRestricted, "Private": ScopePrivate, }
ScopeMapping maps CAP scope values to Scope constants. Callers must not modify it.
var SeverityMapping = map[string]Severity{ "Extreme": SeverityExtreme, "Severe": SeveritySevere, "Moderate": SeverityModerate, "Minor": SeverityMinor, "Unknown": SeverityUnknown, }
SeverityMapping maps CAP severity values to Severity constants. Callers must not modify it.
var StatusMapping = map[string]Status{ "Actual": StatusActual, "Exercise": StatusExercise, "System": StatusSystem, "Test": StatusTest, "Draft": StatusDraft, }
StatusMapping maps CAP status values to Status constants. Callers must not modify it.
var UrgencyMapping = map[string]Urgency{ "Immediate": UrgencyImmediate, "Expected": UrgencyExpected, "Future": UrgencyFuture, "Past": UrgencyPast, "Unknown": UrgencyUnknown, }
UrgencyMapping maps CAP urgency values to Urgency constants. Callers must not modify it.
Functions ¶
func MarshalCAP ¶ added in v1.1.0
MarshalCAP encodes an alert as an indented CAP XML document. Re-encoding a signed alert does not preserve its signature validity.
func SignatureCertificates ¶ added in v1.1.0
func SignatureCertificates(data []byte) ([]*x509.Certificate, error)
SignatureCertificates returns the certificates in the first XML signature. The returned certificates have not been checked for trust.
func VerifySignature ¶ added in v1.1.0
func VerifySignature(data []byte, options SignatureOptions) (*x509.Certificate, error)
VerifySignature verifies the first enveloped XML signature and its signer certificate. When Roots is nil, the system certificate pool is used.
Types ¶
type Alert ¶
type Alert struct {
XMLName xml.Name `xml:"urn:oasis:names:tc:emergency:cap:1.2 alert" json:"-"` // CAP XML root.
Identifier string `xml:"identifier" json:"identifier"` // Unique message ID. Required.
Sender string `xml:"sender" json:"sender"` // Sender ID. Required.
Sent DateTime `xml:"sent" json:"sent"` // Time the message was sent. Required.
Status Status `xml:"status" json:"status"` // Message status. Required.
MsgType MsgType `xml:"msgType" json:"msgType"` // Message type. Required.
Source string `xml:"source,omitempty" json:"source,omitempty"` // Message source.
Scope Scope `xml:"scope" json:"scope"` // Distribution scope. Required.
Restriction string `xml:"restriction,omitempty" json:"restriction,omitempty"` // Rule for restricted distribution.
Addresses string `xml:"addresses,omitempty" json:"addresses,omitempty"` // Intended recipient identifiers or addresses.
Code []string `xml:"code,omitempty" json:"code,omitempty"` // Special handling codes.
Note string `xml:"note,omitempty" json:"note,omitempty"` // Message note.
References *List `xml:"references,omitempty" json:"references,omitempty"` // Earlier messages referenced by this message.
Incidents string `xml:"incidents,omitempty" json:"incidents,omitempty"` // Related incident IDs.
Info []Info `xml:"info,omitempty" json:"info,omitempty"` // Event details.
Signature []Signature `xml:"Signature,omitempty" json:"signature,omitempty"` // XML signatures.
Extensions []Extension `xml:",any" json:"extensions,omitempty"` // Additional XML Signature elements.
}
Alert is a CAP message with routing details and optional event information.
func ParseCAP ¶
ParseCAP decodes an XML CAP 1.2 message. It checks XML syntax, namespaces, dates, and code values. Use Validate or ValidateCAPCP for message rules.
func (*Alert) Validate ¶ added in v1.1.0
func (a *Alert) Validate() Diagnostics
Validate checks the CAP 1.2 rules supported by this package.
func (*Alert) ValidateCAPCP ¶ added in v1.1.0
func (a *Alert) ValidateCAPCP() Diagnostics
ValidateCAPCP checks CAP-CP 1.0 rules that can be determined from one message. It does not verify external event and location lists or the completeness of active message references. It also checks CAP 1.2.
type Algorithm ¶
type Algorithm struct {
Algorithm string `xml:"Algorithm,attr" json:"algorithm"` // Algorithm URI.
}
Algorithm names an XML signature algorithm.
type Area ¶
type Area struct {
XMLName xml.Name `xml:"area" json:"-"` // CAP area element.
AreaDesc string `xml:"areaDesc" json:"areaDesc"` // Area description. Required.
Polygon []List `xml:"polygon,omitempty" json:"polygon,omitempty"` // Affected polygons.
Circle []string `xml:"circle,omitempty" json:"circle,omitempty"` // Affected circles.
Geocode []KeyValue `xml:"geocode,omitempty" json:"geocode,omitempty"` // Area codes.
Altitude *float64 `xml:"altitude,omitempty" json:"altitude,omitempty"` // Altitude or lower bound in feet above mean sea level.
Ceiling *float64 `xml:"ceiling,omitempty" json:"ceiling,omitempty"` // Upper bound in feet above mean sea level.
}
Area describes a place affected by an event.
func (Area) Circles ¶ added in v1.1.0
func (a Area) Circles() ([]CircleGeometry, error)
Circles returns the parsed circles in the area.
func (Area) Polygons ¶ added in v1.1.0
func (a Area) Polygons() ([][]Coordinate, error)
Polygons returns the parsed polygon coordinates in the area.
type Category ¶
type Category int
Category identifies the category of an alert's subject event.
const ( // CategoryGeo covers geophysical events such as landslides. CategoryGeo Category = iota + 1 // CategoryMet covers weather events, including floods. CategoryMet // CategorySafety covers general emergencies and public safety. CategorySafety // CategorySecurity covers law enforcement, military, and security events. CategorySecurity // CategoryRescue covers rescue and recovery. CategoryRescue // CategoryFire covers fire suppression and rescue. CategoryFire // CategoryHealth covers medical and public health events. CategoryHealth // CategoryEnv covers pollution and other environmental events. CategoryEnv // CategoryTransport covers public and private transportation. CategoryTransport // CategoryInfra covers utilities and other infrastructure. CategoryInfra // CategoryCBRNE covers chemical, biological, radiological, nuclear, and // explosive threats. CategoryCBRNE // CategoryOther covers events outside the other categories. CategoryOther )
func (Category) MarshalJSON ¶
MarshalJSON encodes a CAP category value.
func (Category) MarshalXML ¶
MarshalXML encodes a CAP category value.
func (*Category) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP category value.
func (*Category) UnmarshalXML ¶
UnmarshalXML decodes a CAP category value.
type Certainty ¶
type Certainty int
Certainty identifies the certainty of an alert's subject event.
const ( // CertaintyObserved means the event has occurred or is underway. CertaintyObserved Certainty = iota + 1 // CertaintyLikely means the event is more likely than not. The parser also // accepts the deprecated CAP 1.0 value "Very Likely" as this value. CertaintyLikely // CertaintyPossible means the event is possible but not likely. CertaintyPossible // CertaintyUnlikely means the event is not expected. CertaintyUnlikely // CertaintyUnknown means the certainty is unknown. CertaintyUnknown )
func (Certainty) MarshalJSON ¶
MarshalJSON encodes a CAP certainty value.
func (Certainty) MarshalXML ¶
MarshalXML encodes a CAP certainty value.
func (*Certainty) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP certainty value.
func (*Certainty) UnmarshalXML ¶
UnmarshalXML decodes a CAP certainty value.
type CircleGeometry ¶ added in v1.1.0
type CircleGeometry struct {
Center Coordinate // Center point.
RadiusKM float64 // Radius in kilometers.
}
CircleGeometry is a CAP circle center and radius in kilometers.
func ParseCircle ¶ added in v1.1.0
func ParseCircle(value string) (CircleGeometry, error)
ParseCircle parses a CAP circle value.
func (CircleGeometry) String ¶ added in v1.1.0
func (c CircleGeometry) String() string
String returns a CAP circle value.
type Coordinate ¶ added in v1.1.0
type Coordinate struct {
Latitude float64 // Degrees north or south.
Longitude float64 // Degrees east or west.
}
Coordinate is a WGS 84 latitude and longitude pair.
func ParseCoordinate ¶ added in v1.1.0
func ParseCoordinate(value string) (Coordinate, error)
ParseCoordinate parses a CAP latitude,longitude pair.
func (Coordinate) String ¶ added in v1.1.0
func (c Coordinate) String() string
String returns a CAP latitude,longitude pair.
type DateTime ¶
type DateTime struct {
// contains filtered or unexported fields
}
DateTime represents a CAP date-time with a numeric UTC offset.
func NewDateTime ¶ added in v1.1.0
NewDateTime returns a CAP date-time for value. It rejects values that CAP cannot represent.
func ParseDateTime ¶ added in v1.1.0
ParseDateTime parses a CAP date-time value, including its numeric offset.
func (DateTime) MarshalJSON ¶
MarshalJSON encodes a CAP date and time value.
func (DateTime) MarshalXML ¶
MarshalXML encodes a CAP date and time value.
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP date and time value.
func (*DateTime) UnmarshalXML ¶
UnmarshalXML decodes a CAP date and time value.
type Diagnostic ¶ added in v1.1.0
type Diagnostic struct {
Level DiagnosticLevel `json:"level"` // Error or warning.
Path string `json:"path"` // Related field path.
Rule string `json:"rule,omitempty"` // CAP rule or recommendation.
Message string `json:"message"` // Description of the result.
}
Diagnostic describes one validation result.
func (Diagnostic) Error ¶ added in v1.1.0
func (d Diagnostic) Error() string
Error returns the diagnostic message and its field path.
type DiagnosticLevel ¶ added in v1.1.0
type DiagnosticLevel string
DiagnosticLevel says whether a result is an error or warning.
const ( // DiagnosticError marks a failed rule. DiagnosticError DiagnosticLevel = "error" // DiagnosticWarning marks a recommendation. DiagnosticWarning DiagnosticLevel = "warning" )
type Diagnostics ¶ added in v1.1.0
type Diagnostics []Diagnostic
Diagnostics holds validation errors and warnings.
func (Diagnostics) Err ¶ added in v1.1.0
func (d Diagnostics) Err() error
Err returns the validation errors, or nil if there are none.
func (Diagnostics) HasErrors ¶ added in v1.1.0
func (d Diagnostics) HasErrors() bool
HasErrors reports whether any result is an error.
type Extension ¶ added in v1.1.0
type Extension struct {
XMLName xml.Name `json:"name"` // Element name.
Attr []xml.Attr `xml:",any,attr" json:"attributes,omitempty"` // Element attributes.
InnerXML string `xml:",innerxml" json:"innerXML,omitempty"` // Raw child content.
}
Extension preserves an additional XML Signature element at the alert root.
type Info ¶
type Info struct {
XMLName xml.Name `xml:"info" json:"-"` // CAP info element.
Language string `xml:"language,omitempty" json:"language,omitempty"` // Content language.
Category []Category `xml:"category" json:"category"` // Event categories. At least one is required.
Event string `xml:"event" json:"event"` // Event name. Required.
ResponseType []ResponseType `xml:"responseType,omitempty" json:"responseType,omitempty"` // Recommended actions.
Urgency Urgency `xml:"urgency" json:"urgency"` // Event urgency. Required.
Severity Severity `xml:"severity" json:"severity"` // Event severity. Required.
Certainty Certainty `xml:"certainty" json:"certainty"` // Event certainty. Required.
Audience string `xml:"audience,omitempty" json:"audience,omitempty"` // Intended audience.
EventCode []KeyValue `xml:"eventCode,omitempty" json:"eventCode,omitempty"` // Event codes.
Effective *DateTime `xml:"effective,omitempty" json:"effective,omitempty"` // Time the information takes effect.
Onset *DateTime `xml:"onset,omitempty" json:"onset,omitempty"` // Expected start time.
Expires *DateTime `xml:"expires,omitempty" json:"expires,omitempty"` // Expiration time.
SenderName string `xml:"senderName,omitempty" json:"senderName,omitempty"` // Sender's display name.
Headline string `xml:"headline,omitempty" json:"headline,omitempty"` // Short headline.
Description string `xml:"description,omitempty" json:"description,omitempty"` // Event description.
Instruction string `xml:"instruction,omitempty" json:"instruction,omitempty"` // Instructions for recipients.
Web string `xml:"web,omitempty" json:"web,omitempty"` // Link to more information.
Contact string `xml:"contact,omitempty" json:"contact,omitempty"` // Follow-up contact.
Parameter []KeyValue `xml:"parameter,omitempty" json:"parameter,omitempty"` // Extra system values.
Resource []Resource `xml:"resource,omitempty" json:"resource,omitempty"` // Related files.
Area []Area `xml:"area,omitempty" json:"area,omitempty"` // Affected areas.
}
Info describes an event and the action recipients should take. An alert may have several Info values for different areas or languages.
func (Info) EffectiveTime ¶ added in v1.1.0
EffectiveTime returns Effective, or the alert sent time when Effective is omitted.
func (Info) LanguageCode ¶ added in v1.1.0
LanguageCode returns Language, or the CAP default of en-US.
type KeyValue ¶
type KeyValue struct {
ValueName string `xml:"valueName" json:"valueName"` // Name of the code or value domain.
Value string `xml:"value" json:"value"` // Value within that domain.
}
KeyValue holds a named CAP value.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents whitespace-delimited CAP values.
func (List) Coordinates ¶ added in v1.1.0
func (t List) Coordinates() ([]Coordinate, error)
Coordinates parses the list as a sequence of coordinates.
func (List) MarshalJSON ¶
MarshalJSON encodes a whitespace-delimited CAP list.
func (List) MarshalXML ¶
MarshalXML encodes a whitespace-delimited CAP list.
func (*List) UnmarshalJSON ¶
UnmarshalJSON decodes a whitespace-delimited CAP list.
func (*List) UnmarshalXML ¶
UnmarshalXML decodes a whitespace-delimited CAP list.
type MsgType ¶
type MsgType int
MsgType identifies the nature of an alert message.
const ( // MsgTypeAlert provides new information that needs attention. MsgTypeAlert MsgType = iota + 1 // MsgTypeUpdate replaces the messages listed in References. MsgTypeUpdate // MsgTypeCancel cancels the messages listed in References. MsgTypeCancel // MsgTypeAck accepts the messages listed in References. MsgTypeAck // MsgTypeError rejects the messages listed in References. MsgTypeError )
func (MsgType) MarshalJSON ¶
MarshalJSON encodes a CAP message type value.
func (MsgType) MarshalXML ¶
MarshalXML encodes a CAP message type value.
func (*MsgType) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP message type value.
func (*MsgType) UnmarshalXML ¶
UnmarshalXML decodes a CAP message type value.
type Reference ¶
type Reference struct {
URI string `xml:"URI,attr" json:"uri"` // Referenced content.
Transform []Algorithm `xml:"Transforms>Transform" json:"transform"` // Applied transforms.
DigestMethod Algorithm `xml:"DigestMethod" json:"digestMethod"` // Digest algorithm.
DigestValue string `xml:"DigestValue" json:"digestValue"` // Encoded digest.
}
Reference describes signed data and any transforms applied to it.
type Resource ¶
type Resource struct {
XMLName xml.Name `xml:"resource" json:"-"` // CAP resource element.
ResourceDesc string `xml:"resourceDesc" json:"resourceDesc"` // File description. Required.
MimeType string `xml:"mimeType" json:"mimeType"` // MIME type. Required.
Size *int64 `xml:"size,omitempty" json:"size,omitempty"` // File size in bytes.
URI string `xml:"uri,omitempty" json:"uri,omitempty"` // File location.
DerefURI string `xml:"derefUri,omitempty" json:"derefUri,omitempty"` // Base64 encoded file data.
Digest string `xml:"digest,omitempty" json:"digest,omitempty"` // SHA-1 file digest.
}
Resource describes a file related to an Info value.
type ResponseType ¶
type ResponseType int
ResponseType identifies an action recommended for the target audience.
const ( // ResponseTypeShelter tells recipients to take shelter. ResponseTypeShelter ResponseType = iota + 1 // ResponseTypeEvacuate tells recipients to relocate. ResponseTypeEvacuate // ResponseTypePrepare tells recipients to prepare. ResponseTypePrepare // ResponseTypeExecute tells recipients to carry out a planned action. ResponseTypeExecute // ResponseTypeAvoid tells recipients to avoid the event. ResponseTypeAvoid // ResponseTypeMonitor tells recipients to monitor information sources. ResponseTypeMonitor // ResponseTypeAssess tells recipients to assess the information. ResponseTypeAssess // ResponseTypeAllClear means the event no longer poses a threat. ResponseTypeAllClear // ResponseTypeNone means no action is recommended. ResponseTypeNone )
func (ResponseType) MarshalJSON ¶
func (t ResponseType) MarshalJSON() ([]byte, error)
MarshalJSON encodes a CAP response value.
func (ResponseType) MarshalXML ¶
func (t ResponseType) MarshalXML(encoder *xml.Encoder, elem xml.StartElement) error
MarshalXML encodes a CAP response value.
func (ResponseType) String ¶
func (t ResponseType) String() string
String returns the CAP response value.
func (*ResponseType) UnmarshalJSON ¶
func (t *ResponseType) UnmarshalJSON(buff []byte) error
UnmarshalJSON decodes a CAP response value.
func (*ResponseType) UnmarshalXML ¶
func (t *ResponseType) UnmarshalXML(decoder *xml.Decoder, elem xml.StartElement) error
UnmarshalXML decodes a CAP response value.
type Scope ¶
type Scope int
Scope identifies the intended distribution of an alert message.
func (Scope) MarshalJSON ¶
MarshalJSON encodes a CAP scope value.
func (Scope) MarshalXML ¶
MarshalXML encodes a CAP scope value.
func (*Scope) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP scope value.
func (*Scope) UnmarshalXML ¶
UnmarshalXML decodes a CAP scope value.
type Severity ¶
type Severity int
Severity identifies the severity of an alert's subject event.
const ( // SeverityExtreme means an extraordinary threat to life or property. SeverityExtreme Severity = iota + 1 // SeveritySevere means a significant threat to life or property. SeveritySevere // SeverityModerate means a possible threat to life or property. SeverityModerate // SeverityMinor means little or no known threat to life or property. SeverityMinor // SeverityUnknown means the severity is unknown. SeverityUnknown )
func (Severity) MarshalJSON ¶
MarshalJSON encodes a CAP severity value.
func (Severity) MarshalXML ¶
MarshalXML encodes a CAP severity value.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP severity value.
func (*Severity) UnmarshalXML ¶
UnmarshalXML decodes a CAP severity value.
type Signature ¶
type Signature struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Signature" json:"-"` // XML Signature element.
ID string `xml:"Id,attr" json:"id"` // Signature ID.
SignedInfo SignedInfo `xml:"SignedInfo" json:"signedInfo"` // Signed algorithms and references.
SignatureValue string `xml:"SignatureValue" json:"signatureValue"` // Encoded signature value.
X509Certificate []string `xml:"KeyInfo>X509Data>X509Certificate" json:"x509Certificate"` // Encoded certificates.
SignatureProperties []SignatureProperty `xml:"Object>SignatureProperties>SignatureProperty" json:"signatureProperty"` // Signed properties.
}
Signature holds commonly used fields from an enveloped XML signature.
type SignatureOptions ¶ added in v1.1.0
type SignatureOptions struct {
// Roots contains trusted certificate authorities. Nil uses system roots.
Roots *x509.CertPool
// CurrentTime is the certificate verification time. Zero uses time.Now.
CurrentTime time.Time
// KeyUsages limits accepted certificate uses. Empty accepts any use.
KeyUsages []x509.ExtKeyUsage
// CertificateCheck runs after the certificate chain is checked.
CertificateCheck func(*x509.Certificate, [][]*x509.Certificate) error
}
SignatureOptions sets the certificate checks used by VerifySignature.
type SignatureProperty ¶
type SignatureProperty struct {
ID string `xml:"Id,attr" json:"id"` // Property ID.
Target string `xml:"Target,attr" json:"target"` // Property target.
XCValue XCValue `xml:"value" json:"value"` // NAADS xc value.
}
SignatureProperty holds a property covered by a signature.
type SignedInfo ¶
type SignedInfo struct {
CanonicalizationMethod Algorithm `xml:"CanonicalizationMethod" json:"canonicalizationMethod"` // Canonical XML algorithm.
SignatureMethod Algorithm `xml:"SignatureMethod" json:"signatureMethod"` // Signature algorithm.
Reference []Reference `xml:"Reference" json:"reference"` // Signed content references.
}
SignedInfo references signed data and specifies the algorithms used.
type Status ¶
type Status int
Status describes how recipients should handle an alert.
const ( // StatusActual is actionable by all targeted recipients. StatusActual Status = iota + 1 // StatusExercise is actionable only by exercise participants. StatusExercise // StatusSystem is for alert system functions. StatusSystem // StatusTest is for technical testing. StatusTest // StatusDraft is a draft and is not actionable. StatusDraft )
func (Status) MarshalJSON ¶
MarshalJSON encodes a CAP status value.
func (Status) MarshalXML ¶
MarshalXML encodes a CAP status value.
func (*Status) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP status value.
func (*Status) UnmarshalXML ¶
UnmarshalXML decodes a CAP status value.
type Urgency ¶
type Urgency int
Urgency identifies the urgency of an alert's subject event.
const ( // UrgencyImmediate calls for immediate action. UrgencyImmediate Urgency = iota + 1 // UrgencyExpected calls for action within the next hour. UrgencyExpected // UrgencyFuture calls for action later than the next hour. UrgencyFuture // UrgencyPast means action is no longer needed. UrgencyPast // UrgencyUnknown means the urgency is unknown. UrgencyUnknown )
func (Urgency) MarshalJSON ¶
MarshalJSON encodes a CAP urgency value.
func (Urgency) MarshalXML ¶
MarshalXML encodes a CAP urgency value.
func (*Urgency) UnmarshalJSON ¶
UnmarshalJSON decodes a CAP urgency value.
func (*Urgency) UnmarshalXML ¶
UnmarshalXML decodes a CAP urgency value.
type ValidationError ¶ added in v1.1.0
type ValidationError struct {
Diagnostics Diagnostics // Failed validation rules.
}
ValidationError contains validation errors.
func (ValidationError) Error ¶ added in v1.1.0
func (e ValidationError) Error() string
Error returns the first error and the number of additional errors.