# Networking with Go, Made Easy > A free, open-source book that teaches computer networking and network programming in Go (Golang) from first principles through production APIs and ethical hacking/cybersecurity. Author: Omar Flores Salazar. Book text license: CC BY-NC 4.0 (attribution required, non-commercial use only — do not reproduce or retrain on this text for commercial purposes without permission). Example code license: MIT. 151 chapters across 8 parts. Written for complete beginners and experienced engineers at the same time. ## Key facts - Free forever, no paywall, no signup, no ads. - Read online (every chapter on its own page, full-text search): https://sazardev.github.io/networking-with-go/read/index.html - Latest release and PDF download: https://github.com/sazardev/networking-with-go/releases/latest - Source and full table of contents: https://github.com/sazardev/networking-with-go - Full sitemap of all chapter pages: https://sazardev.github.io/networking-with-go/sitemap.xml ## Chapters ### About the Author - [About the Author](https://sazardev.github.io/networking-with-go/read/front-matter/01-about-the-author.html): "I don't know your name, your age, or your story. But if you're reading this, you're already on the path — and I'm rooting for you." ### Networking Foundations - [Introduction to Networking](https://sazardev.github.io/networking-with-go/read/networking-foundations/01-introduction-to-networking.html): Somewhere in the last few seconds, before you even opened this book, your phone quietly asked the world a question. Maybe it checked for a new message. Maybe it refreshed a weather forecast, or… - [History and Evolution of Computer Networks](https://sazardev.github.io/networking-with-go/read/networking-foundations/02-history-and-evolution-of-computer-networks.html): "Imagine a world where computers are like islands, isolated and alone, unable to share their treasures. Now, picture bridges being built, one by one, until a vast, bustling metropolis emerges — this… - [Types of Networks: LAN, WAN, MAN, PAN](https://sazardev.github.io/networking-with-go/read/networking-foundations/03-types-of-networks-lan-wan-man-pan.html): Right now, within arm's reach of you, there is very likely a network so small and so intimate that you have never once thought of it as a network at all. If you are listening to anything through… - [Network Topologies and Architectures](https://sazardev.github.io/networking-with-go/read/networking-foundations/04-network-topologies-and-architectures.html): Picture, for a moment, the street plan of a city you know well. Some cities grew around one great square, with every road eventually leading back to it. Some grew as a grid, endlessly repeatable,… - [The OSI and TCP/IP Models](https://sazardev.github.io/networking-with-go/read/networking-foundations/05-the-osi-and-tcp-ip-models.html): Try, for a moment, to actually hold the whole journey of a single email in your head at once: the words you typed, encoded into bytes; those bytes broken into chunks and numbered so they can be… - [Understanding IP Addressing and Subnetting](https://sazardev.github.io/networking-with-go/read/networking-foundations/06-understanding-ip-addressing-and-subnetting.html): Imagine, for a second, a planet with no postal codes at all — just billions of buildings, no street names, no way to say "the third house past the bakery" to anyone who isn't already standing next to… - [Ports, Sockets, and Endpoints](https://sazardev.github.io/networking-with-go/read/networking-foundations/07-ports-sockets-and-endpoints.html): Look at your laptop right now, before you read another word. It is almost certainly not doing one thing on the network — it is doing five or six at once, and you don't feel any of it happening. A… - [TCP vs UDP: Concepts and Use Cases](https://sazardev.github.io/networking-with-go/read/networking-foundations/08-tcp-vs-udp-concepts-and-use-cases.html): Somewhere around 1980, a small group of engineers had to make a decision that every single video call, download, and multiplayer match you've ever used still lives inside of today. IP, the addressing… - [Common Network Protocols (HTTP, FTP, DNS, etc.)](https://sazardev.github.io/networking-with-go/read/networking-foundations/09-common-network-protocols-http-ftp-dns-etc.html): Imagine two strangers, neither speaking a word of the other's language, trying to complete a business deal through gestures alone. It can be done, badly, with enough patience and luck. Now imagine… - [Network Security Fundamentals](https://sazardev.github.io/networking-with-go/read/networking-foundations/10-network-security-fundamentals.html): In 1971, an experimental little program called Creeper began quietly hopping between mainframes on the ARPANET, displaying a single, oddly cheerful taunt on whatever screen it landed on: "I'm the… - [Firewalls, NAT, and VPNs](https://sazardev.github.io/networking-with-go/read/networking-foundations/11-firewalls-nat-and-vpns.html): "Imagine your network as a medieval city: firewalls are the city walls and gates, NAT is the clever gatekeeper who knows everyone's real and fake names, and VPNs are secret tunnels that let you… - [Network Troubleshooting and Tools](https://sazardev.github.io/networking-with-go/read/networking-foundations/12-network-troubleshooting-and-tools.html): "Imagine you're a digital detective, following clues through tangled wires and invisible signals to solve the mystery of a slow or broken network. With the right tools and a sharp mind, no problem is… - [Performance, Latency, and Bandwidth](https://sazardev.github.io/networking-with-go/read/networking-foundations/13-performance-latency-and-bandwidth.html): "Imagine a race car on a track: speed, smooth turns, and pit stops all matter. In networking, performance, latency, and bandwidth are the keys to winning the digital race!" In August 1858, after a… ### Go From Scratch - [Installing Go and Your First Program](https://sazardev.github.io/networking-with-go/read/go-fundamentals/01-installing-go-and-your-first-program.html): Every craftsperson remembers the day their first real tool arrived. Not a toy version, not a borrowed one — the actual thing, sitting on the bench, waiting to be plugged in and tried. That's this… - [Variables, Types, and Constants](https://sazardev.github.io/networking-with-go/read/go-fundamentals/02-variables-types-and-constants.html): Every program you will ever write, underneath all its cleverness, is just data being stored, read, and transformed — a value coming in from somewhere, sitting in memory for a while, and eventually… - [Functions and Methods](https://sazardev.github.io/networking-with-go/read/go-fundamentals/03-functions-and-methods.html): The previous chapter was about data sitting still — a labeled box, holding a value, refusing to change shape. This chapter is about motion: taking that data and doing something to it, in a way you… - [Structs and Interfaces](https://sazardev.github.io/networking-with-go/read/go-fundamentals/04-structs-and-interfaces.html): Ask a programmer coming from Java, C++, or Python what they miss most when they first pick up Go, and the honest ones will usually say the same thing: classes. No class keyword, no extends , no… - [io.Reader, io.Writer, and Streaming Data](https://sazardev.github.io/networking-with-go/read/go-fundamentals/05-io-reader-io-writer-and-streaming-data.html): Every networked program in Go moves bytes. A TCP connection reads bytes from the network and writes bytes back. An HTTP handler reads a request body and writes a response body. A file server reads a… - [Slices, Arrays, and Maps](https://sazardev.github.io/networking-with-go/read/go-fundamentals/06-slices-arrays-and-maps.html): Look back at every code example in the last chapter and a pattern shows up you probably didn't stop to question: []Rectangle , []T , and — a few chapters from now — things like map[string]int showing… - [Error Handling in Go](https://sazardev.github.io/networking-with-go/read/go-fundamentals/07-error-handling-in-go.html): If you've written code in almost any other mainstream language, you've lived with try / catch , and probably been bitten by it at least once — an exception thrown three layers deep in a library you… - [Packages, Modules, and go.mod](https://sazardev.github.io/networking-with-go/read/go-fundamentals/08-packages-modules-and-go-mod.html): Every program in this book so far has fit comfortably in one file. That won't last, and it shouldn't — a real project needs to split into pieces that different people, or even just a future, more… - [Testing Basics with go test](https://sazardev.github.io/networking-with-go/read/go-fundamentals/09-testing-basics-with-go-test.html): Ask a Go programmer what surprised them most moving from another language, and after "no exceptions" the next answer is often "there's nothing to install to write a test." No framework to choose… - [Goroutines, Channels, and Concurrency](https://sazardev.github.io/networking-with-go/read/go-fundamentals/10-goroutines-channels-and-concurrency.html): Everything in this part of the book so far has been building toward this one chapter, whether or not it said so out loud. Go wasn't designed by people trying to build a slightly nicer C. It was… ### Core Go Networking - [Setting Up Your Go Development Environment](https://sazardev.github.io/networking-with-go/read/core-go-networking/01-setting-up-your-go-development-environment.html): If you completed Go Fundamentals (the section immediately before this one), your Go toolchain is already installed, your editor is configured, and you have written a dozen programs — feel free to… - [Go Language Basics for Networking](https://sazardev.github.io/networking-with-go/read/core-go-networking/02-go-language-basics-for-networking.html): If you completed Go Fundamentals , you already know variables, structs, functions, slices, maps, goroutines, and channels — skip to Chapter 3. This chapter is a condensed networking-oriented… - [Go Networking Packages Overview](https://sazardev.github.io/networking-with-go/read/core-go-networking/03-go-networking-packages-overview.html): "Go's networking packages are like a box of high-tech LEGO bricks—snap them together and you can build anything from a simple chat app to a global-scale web server!" - [Working with IP, Ports, and Addresses: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/04-working-with-ip-ports-and-addresses-concepts-and-go-implementation.html): "Imagine the internet as a vast city. Every building (device) has an address (IP), every door (service) has a number (port), and Go is your GPS, map, and keyring—all in one!" - [TCP in Depth: Protocol Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/05-tcp-in-depth-protocol-theory-and-go-implementation.html): "Imagine sending a letter, but you want to make sure it arrives, in order, and without any missing pages. TCP is the postal service that guarantees delivery, order, and reliability—Go gives you the… - [UDP in Depth: Protocol Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/06-udp-in-depth-protocol-theory-and-go-implementation.html): "Imagine sending postcards—fast, simple, and direct. Sometimes they get lost, sometimes they arrive out of order, but they're perfect for quick messages! UDP is the postcard protocol, and Go lets you… - [Error Handling and Debugging: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/07-error-handling-and-debugging-concepts-and-go-implementation.html): "Imagine you're a detective in the digital world—errors are your clues, and Go gives you the magnifying glass and notebook to solve every mystery!" - [Concurrency in Networking: Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/08-concurrency-in-networking-theory-and-go-implementation.html): "Imagine a busy restaurant kitchen: chefs (goroutines) work on different dishes at the same time, waiters (channels) deliver orders and plates, and the manager (main function) keeps everything… - [Context and Cancellation: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/09-context-and-cancellation-concepts-and-go-implementation.html): "Imagine you're in a busy airport. You're waiting for your flight, but you need to be ready to leave at a moment's notice if your gate changes, your flight is canceled, or you get a call from home.… - [HTTP: Protocol Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/10-http-protocol-theory-and-go-implementation.html): "Imagine a postal service: you write a letter (request), send it to an address (server), and wait for a reply (response). HTTP is the protocol that defines how these letters are formatted, sent, and… - [Handling JSON and XML over HTTP: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/11-handling-json-and-xml-over-http-concepts-and-go-implementation.html): "Imagine you're sending a package (data) through the mail (HTTP). JSON and XML are like the forms you fill out to describe what's inside—structured, standardized, and understood by everyone." - [WebSockets: Real-Time Communication in Go](https://sazardev.github.io/networking-with-go/read/core-go-networking/12-websockets-real-time-communication-in-go.html): "Imagine a phone call instead of sending letters: both sides can talk and listen at any time, instantly. WebSockets turn HTTP from a one-way street into a two-way highway!" - [Chat Applications: Design, Protocols, and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/13-chat-applications-design-protocols-and-go-implementation.html): "Imagine a group conversation where everyone can speak and listen in real time. Chat applications are the classic use case for WebSockets and real-time networking!" - [File Transfer Applications: Protocols and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/14-file-transfer-applications-protocols-and-go-implementation.html): "Sending a chat message is like passing a note across the room. Sending a file is like passing an entire box of documents — you need to say how big the box is, make sure nothing falls out along the… - [Proxy Servers and Clients: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/15-proxy-servers-and-clients-concepts-and-go-implementation.html): "A proxy is like the receptionist at a busy office: visitors don't walk straight to an employee's desk — they talk to the receptionist, who decides who to route them to, checks their badge, and… - [DNS: Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/16-dns-theory-and-go-implementation.html): "Back in the IP addressing chapter, we compared IP addresses to house addresses. DNS is the phonebook that lets you say 'call the pizza place downtown' instead of memorizing its exact street number.… - [NAT Traversal and P2P Networking: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/17-nat-traversal-and-p2p-networking-concepts-and-go-implementation.html): "Imagine two apartment buildings, each with a single front desk that receives all mail for the building. If you want to send a package directly to apartment 4B in the other building, you can't — mail… - [Authentication and Authorization: Security Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/18-authentication-and-authorization-security-theory-and-go-implementation.html): "A bouncer at a club does two separate jobs: check your ID to confirm you are who you say you are (authentication), and check the guest list to decide whether that person is allowed into the VIP room… - [Security in Go Networking: TLS, Encryption, and Best Practices](https://sazardev.github.io/networking-with-go/read/core-go-networking/19-security-in-go-networking-tls-encryption-and-best-practices.html): "Sending data over plain TCP is like shouting across a crowded room — anyone standing between you and the listener can hear every word, and nothing stops them from shouting back pretending to be the… - [Logging and Monitoring: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/20-logging-and-monitoring-concepts-and-go-implementation.html): "A server without logging is a black box in flight with no flight recorder: if something goes wrong at 3 a.m., you're left guessing what happened from the wreckage. Logging and monitoring are the… - [Testing and Debugging Go Network Applications: Theory and Practice](https://sazardev.github.io/networking-with-go/read/core-go-networking/21-testing-and-debugging-go-network-applications-theory-and-practice.html): "Pilots don't learn to handle engine failure by waiting for one at 30,000 feet — they train in a simulator first. Testing network code is the same idea: you want to exercise timeouts, dropped… - [Performance Optimization: Concepts and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/22-performance-optimization-concepts-and-go-implementation.html): "Tuning a race car before you've measured its lap times is just guessing with extra steps. Performance work on a network service follows the same rule: profile first, find the actual bottleneck, then… - [Deploying Go Network Applications: Best Practices](https://sazardev.github.io/networking-with-go/read/core-go-networking/23-deploying-go-network-applications-best-practices.html): "Building a boat in the workshop and sailing it across open water are two very different challenges. Everything you've built in this part of the book — servers, proxies, clients — has been tested at… - [Real-World Projects and Case Studies](https://sazardev.github.io/networking-with-go/read/core-go-networking/24-real-world-projects-and-case-studies.html): "An architect who has only ever looked at blueprints eventually needs to walk through a finished building. This chapter is that walkthrough: stepping back from individual techniques to see how the… - [Email Protocols: Theory and Go Implementation](https://sazardev.github.io/networking-with-go/read/core-go-networking/25-email-protocols-theory-and-go-implementation.html): "Back in the DNS chapter, net.LookupMX("example.com") returned the mail servers responsible for a domain, and the chapter moved on without explaining what those servers actually do with a message… - [Further Resources and Next Steps](https://sazardev.github.io/networking-with-go/read/core-go-networking/26-further-resources-and-next-steps.html): "Reaching the end of a map doesn't mean the territory stops — it means it's time for a new map. Part 2 has covered a lot of ground; this chapter looks back at the route, then points at what's next." ### Advanced & Specialized - [gRPC and Protocol Buffers in Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/01-grpc-and-protocol-buffers-in-go.html): "Imagine two restaurants exchanging orders. One scribbles freeform notes on napkins and hopes the kitchen can guess what "the usual, but spicy" means. The other uses a printed order form with… - [WebRTC and P2P Communication in Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/02-webrtc-and-p2p-communication-in-go.html): "Two people want to talk directly, but neither knows the other's address. So they both call a mutual friend first, who introduces them and passes along contact details, then steps out of the… - [MQTT, AMQP, and IoT Messaging Protocols](https://sazardev.github.io/networking-with-go/read/advanced-specialized/03-mqtt-amqp-and-iot-messaging-protocols.html): "A radio station does not know or care who is listening. It just broadcasts on a frequency, and anyone with a receiver tuned to that frequency hears it. Compare that to a post office, which needs a… - [SDN (Software Defined Networking) and OpenFlow with Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/04-sdn-software-defined-networking-and-openflow-with-go.html): "A city where every traffic light decides on its own, with no coordination, when to turn green is a city with a lot of avoidable gridlock. A city with one control center watching every intersection… - [Network Function Virtualization (NFV) in Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/05-network-function-virtualization-nfv-in-go.html): "A commercial kitchen used to need a dedicated machine for every task: a bread slicer, a meat grinder, a dough mixer, each bolted to the counter, each only able to do its one job. Replace them with a… - [Deep Packet Inspection and Packet Manipulation](https://sazardev.github.io/networking-with-go/read/advanced-specialized/06-deep-packet-inspection-and-packet-manipulation.html): "A postal sorting facility usually just reads the address on the envelope and routes it accordingly -- it never opens the letter inside. Deep packet inspection is what happens when the sorting… - [Custom Protocol Design and Implementation](https://sazardev.github.io/networking-with-go/read/advanced-specialized/07-custom-protocol-design-and-implementation.html): "Two people inventing a board game together need to agree on more than the pieces. Whose turn goes first? How do you signal that your turn is over? What happens if someone disconnects mid-game? What… - [Cloud Networking APIs and Automation with Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/08-cloud-networking-apis-and-automation-with-go.html): "There was a time when getting a new network segment meant an order form, a rack visit, someone physically running cable, and a wait measured in weeks. Cloud networking turned that into a vending… - [Zero Trust Networking and Microsegmentation](https://sazardev.github.io/networking-with-go/read/advanced-specialized/09-zero-trust-networking-and-microsegmentation.html): "An old-style office building checks your badge at the front door and, once you are inside, lets you walk into any room you like -- the assumption is that anyone who made it past the lobby belongs… - [Network Simulation and Virtual Labs](https://sazardev.github.io/networking-with-go/read/advanced-specialized/10-network-simulation-and-virtual-labs.html): "A flight simulator lets a pilot practice an engine failure at ten thousand feet without ever risking a real aircraft or a real passenger. A network simulator offers the same deal to network… - [Automating Network Device Configuration](https://sazardev.github.io/networking-with-go/read/advanced-specialized/11-automating-network-device-configuration.html): "A medieval scribe copied books by hand, one letter at a time, and every copy risked a new typo. The printing press didn't just make copying faster — it made every copy identical. Automating network… - [Observability and Tracing in Go Networking](https://sazardev.github.io/networking-with-go/read/advanced-specialized/12-observability-and-tracing-in-go-networking.html): "A pilot doesn't fly by feel — the cockpit is covered in instruments telling her altitude, speed, and fuel before anything goes wrong. A production network service without observability is a pilot… - [Wireless Networking and Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/13-wireless-networking-and-go.html): "A wired connection is a conversation through a pipe — say something at one end, it arrives at the other. Wireless is shouting across a crowded room and hoping the right person hears you over… - [Mesh Networks and Dynamic Routing](https://sazardev.github.io/networking-with-go/read/advanced-specialized/14-mesh-networks-and-dynamic-routing.html): "A hub-and-spoke airport is elegant until the hub closes for weather — then every flight is grounded. A mesh is more like a bucket brigade at a fire: nobody carries the water the whole way, but… - [High Availability and Load Balancing](https://sazardev.github.io/networking-with-go/read/advanced-specialized/15-high-availability-and-load-balancing.html): "A concert with one entrance is a bottleneck and a fire hazard. A good venue has several doors, staff redirecting people to whichever line is shortest, and a plan for what happens if one door jams.… - [Real-Time Networking for Games](https://sazardev.github.io/networking-with-go/read/advanced-specialized/16-real-time-networking-for-games.html): "TCP is a certified letter: guaranteed delivery, guaranteed order, and a receipt to prove it. A multiplayer game needs a walkie-talkie instead — say the player's position now , and if this update… - [Blockchain and Cryptocurrency Networking](https://sazardev.github.io/networking-with-go/read/advanced-specialized/17-blockchain-and-cryptocurrency-networking.html): "Picture a room full of strangers who don't trust each other, but who all agree to keep an identical copy of the same notebook. Whenever someone writes a new entry, everyone else checks it, copies it… - [Big Data, AI, and Streaming Networks](https://sazardev.github.io/networking-with-go/read/advanced-specialized/18-big-data-ai-and-streaming-networks.html): "An airport baggage system doesn't wait for every suitcase from every flight to arrive before starting to sort — it's a continuous flow of belts, scanners, and diverters, built to keep moving even… - [Go Networking Performance Benchmarks](https://sazardev.github.io/networking-with-go/read/advanced-specialized/19-go-networking-performance-benchmarks.html): "A car might look fast in the driveway. The only way to know for sure is a stopwatch and a track. Benchmarking network code is exactly that: replacing 'this feels quick' with a number you can… - [QUIC and HTTP/3 in Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/20-quic-and-http-3-in-go.html): "Every earlier chapter in this book built on the same assumption: sockets are either the ordered, reliable stream of TCP or the fire-and-forget datagrams of UDP, and never both. QUIC breaks that… - [Message Queues and Service Discovery in Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/21-message-queues-and-service-discovery-in-go.html): "The chat server case study mentioned a message bus standing in for an in-process channel once a single process can no longer hold every connection. This chapter is that message bus, made concrete —… - [IPv6 Networking in Go](https://sazardev.github.io/networking-with-go/read/advanced-specialized/22-ipv6-networking-in-go.html): "The IP addressing chapter back in Part 1 explained why IPv6 exists — 340 undecillion addresses instead of 4 billion. Every Go example since then quietly worked whether you gave it an IPv4 or IPv6… ### Cybersecurity & Ethical Hacking - [Introduction to Cybersecurity in Networking](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/01-introduction-to-cybersecurity-in-networking.html): "A network engineer builds roads between cities. A security engineer asks: who's allowed to drive on them, what happens if a truck crashes in the tunnel, and what do we do if someone forges a license… - [Threat Modeling and Attack Surfaces](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/02-threat-modeling-and-attack-surfaces.html): "Before a locksmith recommends a single lock, they walk the whole building: every door, every window, every vent big enough for a cat. Threat modeling is that walk-through, done for software." - [Common Network Attacks (DoS, MITM, Spoofing, etc.)](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/03-common-network-attacks-dos-mitm-spoofing-etc.html): "A pickpocket, a con artist, and a mob blocking the door all want different things, but they all exploit the same crowded street. Network attacks are no different — the wire is the crowded street." - [Network Scanning and Enumeration with Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/04-network-scanning-and-enumeration-with-go.html): "Before a home inspector signs off on a house, they check every door, every window, and every outlet. Network scanning is that inspection, run against a machine instead of a building." - [Packet Sniffing and Analysis with Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/05-packet-sniffing-and-analysis-with-go.html): "A phone tap doesn't change the call — it just listens to a copy of it. Packet sniffing is the network equivalent: a quiet copy of every frame that crosses an interface, for whoever is allowed to… - [Vulnerability Assessment and Exploitation Basics](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/06-vulnerability-assessment-and-exploitation-basics.html): "Finding a crack in the wall is one skill. Judging whether that crack will bring the wall down is another. Vulnerability assessment is the second skill — and it's the one that decides what actually… - [Building Simple Security Tools in Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/07-building-simple-security-tools-in-go.html): "A carpenter doesn't buy a hammer for every job — sometimes the fastest fix is the one you make yourself, sized exactly to the problem in front of you." - [Penetration Testing Workflows](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/08-penetration-testing-workflows.html): "A fire drill isn't useful because you hope for a fire — it's useful because it proves the exits actually work. A penetration test is a fire drill for your network, run by someone trying, on purpose… - [Incident Response and Forensics](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/09-incident-response-and-forensics.html): "A pentest asks 'can someone get in?' beforehand. Incident response asks 'someone got in — now what?' afterward. Both matter, but only one of them happens on the worst day of your week." - [Ethical Hacking and Legal Considerations](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/10-ethical-hacking-and-legal-considerations.html): "A locksmith who can open any door isn't a criminal — until they open a door that isn't theirs to open, or that no one asked them to. The lockpick is identical either way. Only the permission changes… - [Implementing TLS/SSL in Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/11-implementing-tls-ssl-in-go.html): "Every letter you've sent so far in this book traveled in a clear envelope anyone along the route could open and read. TLS is the sealed, tamper-evident envelope — and Go makes using one almost as… - [Certificate Management and PKI](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/12-certificate-management-and-pki.html): "TLS promises the lock on the door is real. A certificate is the notarized paperwork proving the locksmith who installed it is who they claim to be. PKI is the whole system of notaries that makes… - [Secure Coding Practices in Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/13-secure-coding-practices-in-go.html): "Most break-ins in a building happen through a door that was left unlocked, not a wall someone tunneled through. Most exploited software bugs are the same: an ordinary mistake, not an exotic attack." - [Zero Trust Networking Concepts](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/14-zero-trust-networking-concepts.html): "The old model of network security was a castle: thick walls, one gate, and anyone inside the walls was assumed friendly. Zero trust assumes the castle has already been infiltrated, and checks… - [Network Segmentation and Microsegmentation](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/15-network-segmentation-and-microsegmentation.html): "A ship isn't built as one open hull — it's divided into watertight compartments, so a single puncture floods one section instead of sinking the whole vessel. Network segmentation is the same idea,… - [IDS/IPS: Concepts and Go Implementations](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/16-ids-ips-concepts-and-go-implementations.html): "A burglar alarm only tells you a window broke. A guard who slams the door shut before the intruder gets inside is a different job entirely. Intrusion Detection Systems watch and report; Intrusion… - [SIEM and Log Analysis for Network Security](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/17-siem-and-log-analysis-for-network-security.html): A single firewall log tells you one connection was blocked. A single server log tells you one login succeeded. Neither tells you a breach happened. Put both in the same room, correlate them by time… - [Malware Analysis and Network Indicators](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/18-malware-analysis-and-network-indicators.html): Malware, like a biological pathogen, has to communicate to do damage at scale - it phones home for instructions, exfiltrates what it steals, or spreads to the next host. That communication has to… - [Reverse Engineering Network Protocols](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/19-reverse-engineering-network-protocols.html): Imagine dropping into a foreign city with no dictionary, only a notebook. You can't read the signs, but you can watch what people do after each exchange - which words make the shopkeeper smile, which… - [Red Team vs Blue Team: Concepts and Labs](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/20-red-team-vs-blue-team-concepts-and-labs.html): Chess players get stronger by playing against opponents who actually try to beat them, not by studying the rulebook alone. Security teams are no different: a network defended only on paper, never… - [Social Engineering in Networking](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/21-social-engineering-in-networking.html): You can harden every firewall rule, patch every server, and encrypt every packet, and an attacker can still walk through the front door simply by asking politely and sounding like they belong. The… - [Wireless Network Security: Theory and Attacks](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/22-wireless-network-security-theory-and-attacks.html): Wired traffic stays inside a cable; someone has to physically tap it to listen in. Wireless traffic is broadcast into the air for anyone with an antenna and no scruples to receive - the network… - [IoT Security: Concepts and Go Implementations](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/23-iot-security-concepts-and-go-implementations.html): Give an intern full access to the building and no supervision, and you'd call it a management failure. Yet that's exactly how most IoT devices operate: network access, default credentials nobody… - [Cloud Networking Security](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/24-cloud-networking-security.html): Renting an apartment in a large building means the landlord secures the front doors, the elevators, and the foundation, but you're still the one who has to lock your own apartment door and not tape… - [Container and Kubernetes Network Security](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/25-container-and-kubernetes-network-security.html): Containers are like apartments sharing one building's plumbing and electrical system: each unit feels self-contained, but a serious enough problem in the shared infrastructure below can affect every… - [Bug Bounty and Responsible Disclosure](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/26-bug-bounty-and-responsible-disclosure.html): Finding an unlocked door on someone's building puts you in an interesting position: you can walk away, you can shout about it from the rooftop, or you can knock and let the owner know before anyone… - [Security Automation with Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/27-security-automation-with-go.html): A single analyst can carefully review one alert at a time, forever, or a script can watch every alert continuously and only interrupt a human when something actually needs a human. Security… - [Building a Custom Honeypot in Go](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/28-building-a-custom-honeypot-in-go.html): A honeypot is a fake vault sitting next to the real one, wired with an alarm and a camera. Nobody with legitimate business ever has a reason to open it, so any interaction with it - by definition -… - [Simulating Attacks and Defense in Lab Environments](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/29-simulating-attacks-and-defense-in-lab-environments.html): A flight simulator doesn't just train pilots on the easy days - it deliberately throws engine failures and storms at them, over and over, in an environment where a mistake costs nothing but a… - [Case Studies: Real-World Network Breaches](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/30-case-studies-real-world-network-breaches.html): Every concept in this part of the book - segmentation, IDS/IPS, patching discipline, least privilege, social engineering awareness - exists because a real organization, at some point, learned its… - [Emerging Threats and Future Trends in Network Security](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/31-emerging-threats-and-future-trends-in-network-security.html): Every technique in this book represents the current state of an arms race that never actually ends - each generation of defenses reshapes what the next generation of attacks has to look like, and… - [Further Cybersecurity Resources](https://sazardev.github.io/networking-with-go/read/cybersecurity-ethical-hacking/32-further-cybersecurity-resources.html): "Thirty-one chapters is enough to learn to read a map. It's not enough to know every road. Here's where to keep exploring, both alongside the rest of this book and long after you've finished it." ### Production APIs & Architecture - [API Fundamentals: REST, HTTP, and the Web](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/01-api-fundamentals-rest-http-and-the-web.html): Welcome to Part APIs . This section builds production-ready HTTP APIs and backends in Go — from net/http fundamentals through frameworks, databases, Docker, cloud deployment, and production… - [Designing Clean URLs, Query Params, and Routing](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/02-designing-clean-urls-query-params-and-routing.html): Welcome to the art of designing clean and intuitive URLs. Think of URLs as the street addresses of the web: they guide users and programs to the right destination. A URL is also part of your public… - [JSON, XML, and Data Serialization](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/03-json-xml-and-data-serialization.html): Every API eventually boils down to one question: how do we turn a Go struct into bytes on the wire, and back again? That process is serialization, and Go's standard library gives you two solid,… - [Building RESTful APIs with net/http](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/04-building-restful-apis-with-net-http.html): Go's standard library is unusually capable for building production APIs without a framework. This chapter puts everything from the previous two chapters together — clean routing, query parameters,… - [Building APIs with Gin](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/05-building-apis-with-gin.html): net/http gets you far, but as an API grows — dozens of routes, shared middleware, request binding and validation on every endpoint — the boilerplate adds up. Gin ( github.com/gin-gonic/gin ) is the… - [Building APIs with Fiber](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/06-building-apis-with-fiber.html): Fiber ( github.com/gofiber/fiber/v2 ) is a Go web framework inspired by Express.js, built on top of fasthttp rather than the standard library's net/http . That choice trades some ecosystem… - [Serving HTML, Templates, and Static Files](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/07-serving-html-templates-and-static-files.html): Not every Go server is a pure JSON API. Sometimes you need to render an actual web page — a dashboard, an admin panel, an email preview — and serve the CSS, images, and JavaScript that go with it.… - [Adding WebSockets to Your API](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/08-adding-websockets-to-your-api.html): REST is built around request-response: the client always speaks first. Some features — chat, live dashboards, multiplayer state, collaborative editing — need the server to push data the moment it… - [Notifications, SSE, and Real-Time Updates](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/09-notifications-sse-and-real-time-updates.html): Not every real-time feature needs a full duplex WebSocket connection. Notification feeds, live scoreboards, progress bars, and status updates are all one-directional: the server pushes, the client… - [API Security: Tokens, Auth, and Best Practices](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/10-api-security-tokens-auth-and-best-practices.html): An API without authentication is an API anyone can call — including people you didn't intend to let in. This chapter covers the common authentication schemes you'll actually implement, a working JWT… - [Rate Limiting, CORS, and API Gateways](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/11-rate-limiting-cors-and-api-gateways.html): Authentication answers who can call your API. This chapter covers three separate but related concerns that shape how much they can call it, from where, and — as your API grows — whether a dedicated… - [API Documentation and OpenAPI/Swagger](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/12-api-documentation-and-openapi-swagger.html): A REST endpoint is only as useful as its documentation. OpenAPI (formerly known as Swagger) is the industry-standard, machine-readable format for describing an HTTP API — its paths, request/response… - [Testing and Mocking APIs](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/13-testing-and-mocking-apis.html): An API without tests is a promise you can't verify. Go's standard library makes HTTP handler testing unusually pleasant: net/http/httptest lets you exercise a handler directly, in-process, without… - [Versioning, Deprecation, and Maintenance](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/14-versioning-deprecation-and-maintenance.html): Once an API has real clients, it can't just change shape overnight — every field renamed or endpoint removed is a broken integration somewhere. Versioning is how you evolve an API without breaking… - [Prebuilt Solutions and API Boilerplates](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/15-prebuilt-solutions-and-api-boilerplates.html): Every chapter so far has built things from small pieces — a mux, a middleware chain, a JWT check — on purpose, so the mechanics are visible. In real projects, you don't always want to start from an… - [API Performance, Monitoring, and Observability](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/16-api-performance-monitoring-and-observability.html): An API running in production without visibility into its own behavior is a black box — you find out something's wrong when a user complains, not when it starts happening. Observability covers three… - [Deploying and Scaling Go APIs](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/17-deploying-and-scaling-go-apis.html): Everything up to this point has run on a developer's laptop. This chapter covers what changes when a Go API needs to run reliably, at scale, in production: building deployable artifacts,… - [Advanced API Rate Limiting and Anti-Abuse](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/18-advanced-api-rate-limiting-and-anti-abuse.html): The rate limiting in an earlier chapter used an in-memory rate.Limiter per client — good enough for a single instance, but it breaks down the moment you run more than one, since each instance tracks… - [Advanced API Gateway and Service Mesh](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/19-advanced-api-gateway-and-service-mesh.html): Once an API stops being "one server answering requests" and becomes a dozen services calling each other, two new problems show up. First, clients need a single, stable front door instead of having to… - [APIs for Graph Databases and NoSQL](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/20-apis-for-graph-databases-and-nosql.html): Not every API sits in front of a relational database. Once your data looks like a network of relationships (who follows whom, which products were bought together), or like loosely structured… - [APIs for Background Jobs and Task Queues](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/21-apis-for-background-jobs-and-task-queues.html): Some work is too slow to do inside an HTTP request. Sending a confirmation email, generating a PDF invoice, resizing an uploaded image, or calling a flaky third-party API can take anywhere from a… - [APIs for File Uploads, Media, and Streaming](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/22-apis-for-file-uploads-media-and-streaming.html): JSON payloads are small and fit comfortably in memory. Files don't. A profile picture is a few hundred kilobytes; a video upload can be gigabytes. An API that treats every request body the same way —… - [APIs for Webhooks and Event-Driven Design](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/23-apis-for-webhooks-and-event-driven-design.html): Most of this book so far has been about APIs where the client asks and the server answers. A webhook flips that around: the server calls the client, unprompted, when something happens. Stripe tells… - [APIs for OAuth2, SSO, SAML, OpenID Connect](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/24-apis-for-oauth2-sso-saml-openid-connect.html): "Sign in with Google" buttons, corporate single sign-on portals, and API access tokens all rest on a small set of standards that are frequently confused with each other. OAuth2 is an authorization… - [APIs for Multi-Tenancy and SaaS](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/25-apis-for-multi-tenancy-and-saas.html): A multi-tenant API serves many independent customers ("tenants") from the same running application and, usually, the same database — a project management tool where Acme Corp and Globex Inc both use… - [APIs for Internationalization (i18n) and Localization (l10n)](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/26-apis-for-internationalization-i18n-and-localization-l10n.html): Internationalization (i18n — eighteen letters between the "i" and the "n") is the work of designing your API so it can support multiple languages, currencies, and regional formats. Localization… - [APIs for Feature Flags and Dynamic Config](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/27-apis-for-feature-flags-and-dynamic-config.html): Every deploy used to mean "this code is now live for everyone." Feature flags decouple those two things: the code can be deployed dark, and turned on for 1% of users, then 50%, then everyone — or… - [APIs for Load and Stress Testing](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/28-apis-for-load-and-stress-testing.html): Unit tests tell you your API behaves correctly for one request at a time. They tell you nothing about what happens when a thousand requests arrive per second, or what breaks first when traffic keeps… - [APIs for CI/CD and DevOps](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/29-apis-for-ci-cd-and-devops.html): Continuous integration and deployment pipelines are themselves driven by APIs — GitHub Actions, GitLab CI, and every cloud provider's deployment service expose an HTTP API underneath their UI, and… - [APIs for Serverless and FaaS](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/30-apis-for-serverless-and-faas.html): Everything so far in this book has assumed a long-running process: a Go binary that starts, listens on a port, and handles requests until it's stopped. Function-as-a-Service (FaaS) platforms — AWS… - [APIs for Edge Computing and CDN](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/31-apis-for-edge-computing-and-cdn.html): A traditional API runs in one region (or a handful) and every client, no matter where they are in the world, pays the network latency of reaching it. Edge computing flips that: your code runs in… - [APIs for Advanced Security](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/32-apis-for-advanced-security.html): Basic API security — hashing passwords, checking a bearer token — gets you through the first year of a project. This chapter covers what shows up once an API has real operational maturity behind it:… - [APIs for Advanced Observability: Metrics and Logging](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/33-apis-for-advanced-observability-metrics-and-logging.html): An earlier chapter in this book covered basic performance monitoring — enough to notice that something is slow. This chapter is about instrumenting an API properly: structured logs you can actually… - [APIs for Advanced Observability: Distributed Tracing](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/34-apis-for-advanced-observability-distributed-tracing.html): The previous chapter instrumented a single service well: structured logs, metrics, health checks. But a request to a modern API rarely stays inside one service — it hits a gateway, calls three… - [RPC and gRPC for APIs](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/35-rpc-and-grpc-for-apis.html): So far, almost every API in this part of the book has spoken the same dialect: resources, HTTP verbs, and JSON. That dialect is REST, and it earns its popularity because a browser, a curl command,… - [Working with SQL Databases: PostgreSQL](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/36-working-with-sql-databases-postgresql.html): Every API in this book so far has kept its data in memory or behind an external service. Real APIs need real, durable storage, and for most backend services that means a relational database.… - [Working with SQLite in Go](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/37-working-with-sqlite-in-go.html): The previous chapter treated PostgreSQL as the default choice for a Go API's storage. It is a good default, but it is not the only reasonable one. SQLite -- an entire relational database engine… - [Containerizing Go APIs with Docker](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/38-containerizing-go-apis-with-docker.html): Every API built so far in this book runs however you happen to launch it: go run main.go on your laptop, or a binary copied onto a server by hand. That works until you need the exact same artifact to… - [Clean Architecture for Go APIs](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/39-clean-architecture-for-go-apis.html): Every chapter so far has built one slice of an API — routing, auth, rate limiting, observability. This chapter and the three that follow it step back and ask a different question: once you have all… - [Hexagonal Architecture (Ports and Adapters) for Go APIs](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/40-hexagonal-architecture-ports-and-adapters-for-go-apis.html): Chapter 6.39 drew Clean Architecture as concentric rings and established the rule that matters: dependencies point inward, and domain logic never imports a framework or a driver. Alistair Cockburn's… - [Domain-Driven Design in Go](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/41-domain-driven-design-in-go.html): Chapters 6.39 and 6.40 answered "which package can import which." This chapter answers a different question: once your domain logic lives in its own package, protected from frameworks and databases,… - [Building a Complete Project End-to-End](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/42-building-a-complete-project-end-to-end.html): The last three chapters built the order-management example in pieces: the package layout and dependency direction (Chapter 6.39), the ports-and-adapters vocabulary and a fast in-memory test double… - [Deploying to Google Cloud](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/43-deploying-to-google-cloud.html): Chapter 6.38 covered building a Go API into a small, distroless container image with a multi-stage Dockerfile, and Chapter 6.17 covered the general shape of running that image reliably at scale. This… - [Orchestration, Replicas, and Graceful Shutdown](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/44-orchestration-replicas-and-graceful-shutdown.html): Chapter 6.17 introduced running multiple replicas behind a load balancer and sketched a first graceful shutdown using signal.NotifyContext and http.Server.Shutdown . This chapter goes deeper on both… - [Thinking Like an Attacker: API Security](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/45-thinking-like-an-attacker-api-security.html): Chapter 6.10 built authentication and Chapter 6.11 added rate limiting at the traffic level — both defensive, both essential, and both easy to trust a little too much on their own. A valid token or a… - [Caching and Redis for Go APIs](https://sazardev.github.io/networking-with-go/read/production-apis-architecture/46-caching-and-redis-for-go-apis.html): Every database chapter so far assumed each request earns its own round trip to PostgreSQL or SQLite. For a lot of endpoints that's perfectly fine—but some queries get asked thousands of times a… ### A Final Word - [A Final Word](https://sazardev.github.io/networking-with-go/read/back-matter/01-a-final-word.html): ## More - Full text of every chapter (for grounding): https://sazardev.github.io/networking-with-go/llms-full.txt - Browse by topic: https://sazardev.github.io/networking-with-go/read/topics/index.html - Chapter feed (Atom): https://sazardev.github.io/networking-with-go/feed.xml - FAQ: https://sazardev.github.io/networking-with-go/#faq - Contributing: https://github.com/sazardev/networking-with-go/blob/master/.github/CONTRIBUTING.md - Book text license (CC BY-NC 4.0): https://github.com/sazardev/networking-with-go/blob/master/LICENSE-CONTENT - Code license (MIT): https://github.com/sazardev/networking-with-go/blob/master/LICENSE