Documentation
¶
Overview ¶
Package message defines versioned, policy-neutral queue contracts.
Index ¶
Constants ¶
const ( SpecVersion = "1.0" ScanJobSchemaVersion = "1.0" ScanControlSchemaVersion = "1.0" ScanRequested = "sirius.scan.requested" ScanCancelRequested = "sirius.scan.cancel.requested" )
Variables ¶
var ErrUnknownCorrelation = errors.New("unknown or already completed correlation ID")
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
SpecVersion string `json:"spec_version"`
ID string `json:"id"`
Type string `json:"type"`
Source string `json:"source"`
SchemaVersion string `json:"schema_version"`
CorrelationID string `json:"correlation_id,omitempty"`
CausationID string `json:"causation_id,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
CreatedAt time.Time `json:"created_at"`
ResourceScope *scope.ResourceScope `json:"resource_scope,omitempty"`
Payload json.RawMessage `json:"payload"`
}
Envelope carries a stable message identity, optional attribution, and a separately versioned payload. Scope authorization belongs to the publisher.
func (Envelope) ValidateScanControl ¶
func (e Envelope) ValidateScanControl() (ScanControl, error)
ValidateScanControl validates an exact-ID cancellation request.
func (Envelope) ValidateScanJob ¶
ValidateScanJob rejects unsupported contract versions before interpreting a payload. Additional JSON fields remain valid within v1.
type RPCRequest ¶ added in v0.0.26
RPCRequest identifies one request and the reply destination chosen by its caller. Reply destinations must be private to the caller or have a consumer that routes every delivery through the same ReplyRouter.
type ReplyRouter ¶ added in v0.0.26
type ReplyRouter struct {
// contains filtered or unexported fields
}
ReplyRouter dispatches replies to registered requests without consuming a reply for an unrelated request. Its zero value is ready to use.
func (*ReplyRouter) Deliver ¶ added in v0.0.26
func (r *ReplyRouter) Deliver(correlationID string, payload []byte) error
Deliver sends a reply only to the waiter with the matching correlation ID. Duplicate, late, and unsolicited replies are rejected.
func (*ReplyRouter) Register ¶ added in v0.0.26
func (r *ReplyRouter) Register(replyTo string) (RPCRequest, *ReplyWaiter, error)
Register creates a fresh correlation and returns its request metadata and a waiter. The caller must eventually call Wait, including when publishing fails.
type ReplyWaiter ¶ added in v0.0.26
type ReplyWaiter struct {
// contains filtered or unexported fields
}
ReplyWaiter is a single-use handle returned by Register.
type ScanControl ¶
type ScanJob ¶
type ScanJob struct {
ScanID string `json:"scan_id"`
Targets []ScanTarget `json:"targets"`
Options ScanOptions `json:"options"`
Priority int `json:"priority,omitempty"`
CallbackURL string `json:"callback_url,omitempty"`
StateMode string `json:"state_mode,omitempty"`
}
type ScanOptions ¶
type ScanOptions struct {
TemplateID string `json:"template_id"`
PortRange string `json:"port_range"`
Aggressive bool `json:"aggressive"`
ExcludePorts []string `json:"exclude_ports"`
ScanTypes []string `json:"scan_types"`
MaxRetries int `json:"max_retries"`
Parallel bool `json:"parallel"`
FingerprintProbes []string `json:"fingerprint_probes,omitempty"`
FingerprintTimeout string `json:"fingerprint_timeout,omitempty"`
DisableICMP bool `json:"disable_icmp,omitempty"`
}