MCPcopy Create free account
hub / github.com/SamNet-dev/snix / dispatch

Method dispatch

core/engine/engine.go:107–125  ·  view source on GitHub ↗

dispatch classifies the packet, updates flow state, and decides on a verdict. It MUST call packet.Verdict exactly once.

(p platform.Packet)

Source from the content-addressed store, hash-verified

105// dispatch classifies the packet, updates flow state, and decides on a
106// verdict. It MUST call packet.Verdict exactly once.
107func (e *Engine) dispatch(p platform.Packet) {
108 parsed, err := parse(p.Raw)
109 if err != nil {
110 p.Verdict(platform.Accept)
111 return
112 }
113
114 key, relevant := e.flowKey(p.Dir, parsed)
115 if !relevant {
116 p.Verdict(platform.Accept)
117 return
118 }
119
120 if p.Dir == platform.DirOutbound {
121 e.handleOutbound(key, parsed, p)
122 return
123 }
124 e.handleInbound(key, parsed, p)
125}
126
127// flowState is what we stash alongside each conntrack.Connection so each
128// flow can independently choose its own SNI, strategy, and IP-ID delta.

Callers 1

RunMethod · 0.95

Calls 4

flowKeyMethod · 0.95
handleOutboundMethod · 0.95
handleInboundMethod · 0.95
parseFunction · 0.85

Tested by

no test coverage detected