Documentation
¶
Index ¶
Constants ¶
View Source
const ETH_P_ALL = 0x0003
View Source
const IFACE_BUFFER_SIZE = 50
View Source
const TYPE_802_1Q = 0x8100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iface ¶
type Iface interface {
SendLoop(chan int)
RecvLoop(chan IncomingFrame, chan int)
Out([]byte) error
}
type IncomingFrame ¶
type IncomingFrame struct {
FRAME *ethernet.Frame
SRC_ADDR net.Addr
IN_PORT *SwitchPort
}
type SwitchPort ¶
type SwitchPort struct {
Name string
IFI *net.Interface
Conn *raw.Conn
VLAN int
Status bool
OutBuf chan *ethernet.Frame
Trunk bool
AllowedVLANs []int
// contains filtered or unexported fields
}
func NewSwitchPort ¶
func NewSwitchPort(ifname string, isTrunk bool, vlans ...int) (SwitchPort, error)
func (*SwitchPort) Down ¶
func (s *SwitchPort) Down() error
func (*SwitchPort) Out ¶
func (s *SwitchPort) Out(frame *ethernet.Frame)
func (*SwitchPort) RecvLoop ¶
func (s *SwitchPort) RecvLoop(controlChannel chan IncomingFrame, close chan int)
func (*SwitchPort) SendLoop ¶
func (s *SwitchPort) SendLoop(close chan int)
func (*SwitchPort) Up ¶
func (s *SwitchPort) Up(controlChannel chan IncomingFrame) error
Click to show internal directories.
Click to hide internal directories.