This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package link | |
type Link struct { | |
cost uint | |
ep1 EndPoint | |
ep2 EndPoint | |
} | |
func (l *Link) AttachEndpoint(ep EndPoint) error { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package link | |
type Addr string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package link | |
type Transmitter interface { | |
Transmit(frame []byte) error | |
} | |
type Interface interface { | |
Transmitter | |
EndPoint | |
Address() types.HwAddr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ForwardEntry struct { | |
// Incoming is port id attached to switch | |
Incoming Id | |
// Addr is destination node address | |
Addr types.HwAddr | |
// Time is timestamp when this entry is created | |
Time time.Time | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Port can transmit data and can be point of link. But it has no hardware | |
// address. Before using Port, it must register its own Id | |
type Port interface { | |
Transmitter | |
EndPoint | |
Register(id Id) | |
Registered() bool | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Forward receives id of port it receives frame, address of sender | |
// and frame to send to receiver. Based on id and address it determines whether to | |
// broadcast frame or forward it to others, otherwise just discard frame. | |
func (s *Switch) Forward(incoming Id, frame na.Frame) error { | |
s.Table.Update(incoming, frame.Src) | |
frm, err := s.frmEnc.Encode(frame) | |
if err != nil { | |
return err | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Build() (host1 *link.Host, host2 *link.Host, host3 *link.Host, | |
swch1 *link.Switch, swch2 *link.Switch) { | |
// setup node | |
host1 = link.NewHost() | |
host2 = link.NewHost() | |
host3 = link.NewHost() | |
swch1 = link.NewSwitch() | |
swch2 = link.NewSwitch() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Build() (host1 *link.Host, host2 *link.Host, host3 *link.Host, | |
swch1 *link.Switch, swch2 *link.Switch) { | |
// setup node | |
... | |
// setup interface | |
intf1 := link.NewInterface(40001, link.AddrFromStr("11-11-11-11-11-11"), host1) | |
attachInterface(host1, intf1) | |
intf2 := link.NewInterface(40002, link.AddrFromStr("22-22-22-22-22-22"), host2) | |
attachInterface(host2, intf2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Build() (host1 *link.Host, host2 *link.Host, host3 *link.Host, | |
swch1 *link.Switch, swch2 *link.Switch) { | |
// setup node | |
// setup interface | |
... | |
// setup link | |
link1 := link.NewLink(1) | |
attachLink(intf1, link1) | |
attachLink(sp11, link1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. # $DAEMON_HOME | |
βββ config | |
βββ cosmovisor | |
β βββ current # symbolic link | |
β βββ genesis | |
β β βββ bin | |
β β βββ simappd # $DAEMON_NAME | |
β βββ upgrades | |
β βββ v2.0.0 # upgrade name | |
β βββ bin |