Implementing a network protocol in Go

By Matt Layher

Elevator Pitch

Network protocols form the foundation of computer networks, and learning how these protocols work is a fascinating and rewarding exercise! During this talk, you will learn how to implement a network protocol in Go, building up from individual bytes all the way to complete network communications.


Modern computer networks are incredibly complex, and a huge variety of different network protocols are used to enable communication between machines. Learning how these protocols make computer networks possible is a fascinating and rewarding exercise! At their core, network protocols are no more than a series of bytes on a wire that can be used to encode structured messages.

This talk will focus on lessons learned during implementation of an IPv6 Neighbor Discovery Protocol (NDP) package in Go. NDP is used to enable IPv6 hosts and routers to identify each other on a local network, similar to how ARP is used in IPv4. It is chosen specifically because it is a well-designed and straightforward protocol that can be easily explored on a typical network using tools like tcpdump and wireshark.

During this talk, attendees will learn about:

  • best practices for working with the net and packages
  • building types that can be converted to and from network protocol byte equivalents
  • testing and fuzzing (via go-fuzz) binary network protocol messages
  • implementing connection types which can speak a protocol over a network
  • end to end testing of network connections via ephemeral test listeners
  • using tcpdump/wireshark to capture, inspect, and verify traffic generated by networking packages


This talk is intended for intermediate Go users who are interested in exploring different facets of networking in Go outside of the typical HTTP servers.

This talk will acquaint attendees with some of the basics of NDP and IPv6, and it also provides an excellent opportunity to acquaint the audience with for lower level ICMPv6 socket operations. On top of the networking aspects, I also plan to cover techniques for dealing with collections of bytes in Go. go-fuzz, in particular, is an invaluable tool worthy of its own talk, but I will only cover the basics of using it to fuzz protocol parsers.

I believe I am an excellent candidate to deliver this talk because I have a great deal of experience implementing high quality, well-tested, network protocol packages in Go. Virtual networking is my primary focus at work, and I am extremely passionate about the field as a whole. In addition, I maintain a large number of open source Go and networking related repositories, and have previously blogged and spoken about the topic at other conferences.