Last active
October 31, 2020 12:22
-
-
Save zeroFruit/00335ac80791a246283a9294c5d189db to your computer and use it in GitHub Desktop.
Modeling the Internet from the scratch: Link-layer, LAN, Switch - Code snippet: Host, Interface
This file contains hidden or 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 | |
} | |
// NetHandler receives serialized frame payload. With this, doing some high-level protocol | |
type NetHandler interface { | |
Handle(pl []byte) | |
} | |
type Host struct { | |
Interface Interface | |
netHandler NetHandler | |
frmEnc *FrameEncoder | |
frmDec *FrameDecoder | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment