Documentation
¶
Overview ¶
Package view maintains an ordered, filtered flow store and frontend focus. All access, including subscriptions and snapshots, must run inside hooks, commands or master.Do; the addon dispatch lock serializes its state.
Index ¶
- type Event
- type Focus
- type Settings
- type View
- func (v *View) Add(_ context.Context, flows []flow.Flow)
- func (v *View) At(index int) (flow.Flow, error)
- func (v *View) Configure(ctx context.Context, updated map[string]struct{}) error
- func (v *View) Contains(f flow.Flow) bool
- func (v *View) DNSError(ctx context.Context, f *flow.DNSFlow) error
- func (v *View) DNSRequest(ctx context.Context, f *flow.DNSFlow) error
- func (v *View) DNSResponse(ctx context.Context, f *flow.DNSFlow) error
- func (v *View) Done(context.Context) error
- func (v *View) Error(ctx context.Context, f *flow.HTTPFlow) error
- func (v *View) Flows() []flow.Flow
- func (v *View) GetByID(id string) flow.Flow
- func (v *View) Index(f flow.Flow) int
- func (v *View) Intercept(ctx context.Context, f flow.Flow) error
- func (v *View) Kill(ctx context.Context, f flow.Flow) error
- func (v *View) Len() int
- func (v *View) Load(ctx context.Context, loader *addon.Loader) error
- func (v *View) Notify(fn func()) func()
- func (v *View) Observe(fn func(Event)) func()
- func (v *View) RequestHeaders(ctx context.Context, f *flow.HTTPFlow) error
- func (v *View) Response(ctx context.Context, f *flow.HTTPFlow) error
- func (v *View) Resume(ctx context.Context, f flow.Flow) error
- func (v *View) SetFilter(expression filter.Expr)
- func (v *View) StoreCount() int
- func (v *View) Subscribe(capacity int) (<-chan Event, func())
- func (v *View) TCPEnd(ctx context.Context, f *flow.TCPFlow) error
- func (v *View) TCPError(ctx context.Context, f *flow.TCPFlow) error
- func (v *View) TCPMessage(ctx context.Context, f *flow.TCPFlow) error
- func (v *View) TCPStart(ctx context.Context, f *flow.TCPFlow) error
- func (v *View) UDPEnd(ctx context.Context, f *flow.UDPFlow) error
- func (v *View) UDPError(ctx context.Context, f *flow.UDPFlow) error
- func (v *View) UDPMessage(ctx context.Context, f *flow.UDPFlow) error
- func (v *View) UDPStart(ctx context.Context, f *flow.UDPFlow) error
- func (v *View) Update(_ context.Context, flows []flow.Flow) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
Event describes a view, store or focus change. Kind is view_add, view_remove, view_update, view_refresh, store_add, store_remove, store_refresh or focus. Index is the ascending index before removal, matching upstream's signal. Flow is nil for refresh and focus events. Subscribe delivers dispatch-owned flows that require master.Do before inspection. Observe delivers detached, independently owned copies with the original flow identity and live flag.
type Focus ¶
type Focus struct {
// contains filtered or unexported fields
}
Focus tracks one selected visible flow. Its methods require the dispatch lock.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings holds transient string settings that expire when a flow is removed.
type View ¶
type View struct {
// Focus tracks the selected flow.
Focus *Focus
// Settings holds transient per-flow frontend values.
Settings *Settings
// contains filtered or unexported fields
}
View stores flows in insertion order and exposes a separately ordered view. Construct it with New; the zero value is not usable.
func New ¶
New constructs a View. A nil manager permits standalone store use; commands that notify other addons require a manager.
func (*View) Add ¶
Add stores previously unseen flows and adds those matching the filter to the view. Like upstream, marked-only mode affects refiltering, not this path.
func (*View) DNSRequest ¶
DNSRequest adds a DNS query flow.
func (*View) DNSResponse ¶
DNSResponse refreshes a DNS response flow.
func (*View) Intercept ¶
Intercept refreshes an intercepted flow. The core addon uses Update at runtime.
func (*View) Notify ¶
func (v *View) Notify(fn func()) func()
Notify registers a synchronous payload-free callback for the same event sequence as Observe, without copying flows. Callbacks may only mark dirty or wake a consumer nonblocking; they must not mutate the view, perform I/O or wait for another dispatch. Registration, notification and the idempotent unsubscribe require addon dispatch. Unsubscribe affects later emissions, not the captured callback set of an in-flight emission. A nil callback is ignored. Notify starts no goroutines. Use Observe when the consumer needs detached event payloads.
func (*View) Observe ¶
Observe registers a synchronous observer of the existing event sequence. Registration, notification and the idempotent unsubscribe require addon dispatch. Each callback receives its own detached Flow copy, safe to retain or mutate without changing the store or other observers. Copying preserves the original ID and Live flag. The callback must not mutate the view, perform I/O or wait for another dispatch; it may only copy/serialize and enqueue nonblocking data. Unsubscribe affects later emissions, not the captured callback set of an in-flight emission. A nil callback is ignored. Observe starts no goroutines.
func (*View) RequestHeaders ¶
RequestHeaders adds the HTTP flow when its headers arrive.
func (*View) SetFilter ¶
SetFilter replaces the filter and rebuilds the visible view. Nil matches all flows.
func (*View) StoreCount ¶
StoreCount returns the number of stored flows, including hidden flows.
func (*View) Subscribe ¶
Subscribe returns a bounded event channel and cancellation function. The capacity is at least one. Sends never block: overflow closes and removes that subscriber, leaving queued events readable. The consumer must resnapshot after closure. Subscribe and cancel, like all View access, require the dispatch lock. No goroutine is started and consumers must not wait under that lock.
func (*View) TCPMessage ¶
TCPMessage refreshes a TCP flow after a message.
func (*View) UDPMessage ¶
UDPMessage refreshes a UDP flow after a datagram.