-
Notifications
You must be signed in to change notification settings - Fork 663
/
bridge.go
44 lines (33 loc) · 881 Bytes
/
bridge.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package router
import (
"net"
)
// Interface to packet handling on the local virtual bridge
type Bridge interface {
// Inject a packet to be delivered locally
InjectPacket(PacketKey) FlowOp
// Start consuming packets from the bridge. Injected packets
// should not be included.
StartConsumingPackets(BridgeConsumer) error
Interface() *net.Interface
String() string
Stats() map[string]int
}
// A function that determines how to handle locally captured packets.
type BridgeConsumer func(PacketKey) FlowOp
type NullBridge struct{}
func (NullBridge) InjectPacket(PacketKey) FlowOp {
return nil
}
func (NullBridge) StartConsumingPackets(BridgeConsumer) error {
return nil
}
func (NullBridge) Interface() *net.Interface {
return nil
}
func (NullBridge) String() string {
return "<no bridge networking>"
}
func (NullBridge) Stats() map[string]int {
return nil
}