Skip to content

Instantly share code, notes, and snippets.

@zeroFruit
Last active October 31, 2020 12:18
Show Gist options
  • Save zeroFruit/2d656cbd22edd627654e4419ce4f5251 to your computer and use it in GitHub Desktop.
Save zeroFruit/2d656cbd22edd627654e4419ce4f5251 to your computer and use it in GitHub Desktop.
Modeling the Internet from the scratch: Link-layer, LAN, Switch - Code snippet: Network Adapter
package na
// Card is abstracted network adapter part to simulate bytes transport on
// physical cable. Node's interface uses this interface to send frame
// between nodes.
type Card interface {
Send(buf []byte, addr string) (time.Time, error)
Recv() <-chan *FrameData
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment