add Bridge.Interface()
This commit is contained in:
1 parent
f12ec3b295
commit
e5c256daa1
3 files changed
+17
No files matched your search
@@ -1,5 +1,9 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
// Interface to packet handling on the local virtual bridge
|
// Interface to packet handling on the local virtual bridge
|
||||||
type Bridge interface {
|
type Bridge interface {
|
||||||
// Inject a packet to be delivered locally
|
// Inject a packet to be delivered locally
|
||||||
@@ -9,6 +13,7 @@ type Bridge interface {
|
|||||||
// should not be included.
|
// should not be included.
|
||||||
StartConsumingPackets(BridgeConsumer) error
|
StartConsumingPackets(BridgeConsumer) error
|
||||||
|
|
||||||
|
Interface() *net.Interface
|
||||||
String() string
|
String() string
|
||||||
Stats() map[string]int
|
Stats() map[string]int
|
||||||
}
|
}
|
||||||
@@ -26,6 +31,10 @@ func (NullBridge) StartConsumingPackets(BridgeConsumer) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (NullBridge) Interface() *net.Interface {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (NullBridge) String() string {
|
func (NullBridge) String() string {
|
||||||
return "<no bridge networking>"
|
return "<no bridge networking>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,10 @@ func (fastdp *FastDatapath) Bridge() Bridge {
|
|||||||
return fastDatapathBridge{fastdp}
|
return fastDatapathBridge{fastdp}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fastdp fastDatapathBridge) Interface() *net.Interface {
|
||||||
|
return fastdp.iface
|
||||||
|
}
|
||||||
|
|
||||||
func (fastdp fastDatapathBridge) String() string {
|
func (fastdp fastDatapathBridge) String() string {
|
||||||
return fmt.Sprint(fastdp.dpname, " (via ODP)")
|
return fmt.Sprint(fastdp.dpname, " (via ODP)")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ func newPcapHandle(ifName string, promisc bool, snaplen int, bufSz int) (handle
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Pcap) Interface() *net.Interface {
|
||||||
|
return p.iface
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Pcap) String() string {
|
func (p *Pcap) String() string {
|
||||||
return fmt.Sprint(p.iface.Name, " (via pcap)")
|
return fmt.Sprint(p.iface.Name, " (via pcap)")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user