Introduce IntraHost
This commit is contained in:
1 parent
b77abf480b
commit
ef0153cb0f
5 files changed
+125
-94
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package router
|
||||
|
||||
// Interface to intra-host (i.e. container) packet handling
|
||||
type IntraHost interface {
|
||||
// Inject a packet to be delivered locally
|
||||
InjectPacket([]byte) error
|
||||
|
||||
// Start consuming packets
|
||||
ConsumePackets(IntraHostConsumer) error
|
||||
}
|
||||
|
||||
type IntraHostConsumer interface {
|
||||
// A locally captured packet. The caller must supply an
|
||||
// EthernetDecoder specific to this thread, but it should not
|
||||
// have been used to decode the packet data.
|
||||
CapturedPacket([]byte, *EthernetDecoder)
|
||||
}
|
||||
|
||||
type NullIntraHost struct{}
|
||||
|
||||
func (NullIntraHost) InjectPacket([]byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (NullIntraHost) ConsumePackets(IntraHostConsumer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (NullIntraHost) String() string {
|
||||
return "<no intra-host networking>"
|
||||
}
|
||||
Reference in new issue
Block a user