The Go standard library provides a lot of support for network operations. It includes packages that allow you to manage TCP/IP, UDP, DNS, mail, and RPC using HTTP. Third-party packages can also fill in the gaps from what's included in the standard library, including gorilla/websockets (https://github.com/gorilla/websocket/) for a WebSocket implementation that can be used in a normal HTTP handler. This chapter explores these libraries and demonstrates some simple recipes for how you can make use of each of them. These recipes will assist developers who are unable to use a higher-level abstraction such as REST or GRPC, but need network connectivity. It's also useful for DevOps applications that need to perform DNS lookups or work with raw emails. After reading this chapter, you should've gained some mastery of basic networking programming and be prepared to dive deeper.
In this chapter...