Muutke küpsiste eelistusi

Network Programming with Go: Code Secure and Reliable Network Services from Scratch [Pehme köide]

  • Formaat: Paperback / softback, 392 pages, kõrgus x laius: 234x177 mm
  • Ilmumisaeg: 25-Mar-2021
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1718500882
  • ISBN-13: 9781718500884
Teised raamatud teemal:
  • Formaat: Paperback / softback, 392 pages, kõrgus x laius: 234x177 mm
  • Ilmumisaeg: 25-Mar-2021
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1718500882
  • ISBN-13: 9781718500884
Teised raamatud teemal:
Shows you how to leverage the Go programming language's concurrency and rich standard library to write robust network programs. You'll learn how to write secure, network software in idiomatic Go using the language's latest features.

In Network Programming with Go you'll learn how to leverage Go's concurrency and rich standard library to write robust network programs to create and handle network connections. You'll learn how to craft custom HTTP/2 and SSH servers, build secure network connections with HTTPS, HTTP/2, SSH, TLS, encrypted port forwarding, integrate TLS with free Let's Encrypt certificates, structured logging, and metrics. The author also connects network applications with corresponding cloud offerings such as AWS, Azure, and Google Cloud and shows how to programmatically interact with these providers using their software development kits. Difficult concepts are explained with analogies, diagrams, and examples as you learn to solve common networking problems and write secure software. For professional developers and experienced Go programmers.
Acknowledgments xvii
Introduction xix
Who This Book Is For xx
Installing Go xx
Recommended Development Environments xxi
What's in This Book xxi
PART I NETWORK ARCHITECTURE
1(42)
1 An Overview Of Networked Systems
3(14)
Choosing a Network Topology
3(3)
Bandwidth vs. Latency
6(1)
The Open Systems Interconnection Reference Model
7(5)
The Hierarchal Layers of the OSI Reference Model
8(2)
Sending Traffic by Using Data Encapsulation
10(2)
The TCP/IP Model
12(1)
The Application Layer
13(1)
The Transport Layer
14(1)
The Internet Layer
14(1)
The Link Layer
15(1)
What You've Learned
15(2)
2 Resource Location And Traffic Routing
17(26)
The Internet Protocol
18(1)
IPv4 Addressing
18(8)
Network and Host IDs
19(1)
Subdividing IPv4 Addresses into Subnets
20(3)
Ports and Socket Addresses
23(1)
Network Address Translation
24(1)
Unicasting, Multicasting, and Broadcasting
25(1)
Resolving the MAC Address to a Physical Network Connection
26(1)
IPv6 Addressing
26(5)
Writing IPv6 Addresses
26(2)
IPv6 Address Categories
28(2)
Advantages of IPv6 over IPv4
30(1)
The Internet Control Message Protocol
31(1)
Internet Traffic Routing
32(1)
Routing Protocols
33(1)
The Border Gateway Protocol
34(1)
Name and Address Resolution
34(7)
Domain Name Resource Records
35(5)
Multicast DNS
40(1)
Privacy and Security Considerations of DNS Queries
40(1)
What You've Learned
41(2)
PART II SOCKET-LEVEL PROGRAMMING
43(120)
3 Reliable Tcp Data Streams
45(28)
What Makes TCP Reliable?
46(1)
Working with TCP Sessions
46(5)
Establishing a Session with the TCP Handshake
47(1)
Acknowledging Receipt of Packets by Using Their Sequence Numbers
47(1)
Receive Buffers and Window Sizes
48(2)
Gracefully Terminating TCP Sessions
50(1)
Handling Less Graceful Terminations
51(1)
Establishing a TCP Connection by Using Go's Standard Library
51(20)
Binding, Listening for, and Accepting Connections
51(2)
Establishing a Connection with a Server
53(9)
Implementing Deadlines
62(9)
What You've Learned
71(2)
4 Sending TCP Data
73(32)
Using the net.Conn Interface
74(1)
Sending and Receiving Data
74(13)
Reading Data into a Fixed Buffer
74(2)
Delimited Reading by Using a Scanner
76(3)
Dynamically Allocating the Buffer Size
79(7)
Handling Errors While Reading and Writing Data
86(1)
Creating Robust Network Applications by Using the io Package
87(11)
Proxying Data Between Connections
87(6)
Monitoring a Network Connection
93(3)
Pinging a Host in ICMP-Filtered Environments
96(2)
Exploring Go's TCPConn Object
98(3)
Controlling Keepalive Messages
99(1)
Handling Pending Data on Close
99(1)
Overriding Default Receive and Send Buffers
100(1)
Solving Common Go TCP Network Problems
101(1)
Zero Window Errors
101(1)
Sockets Stuck in the CLOSE WAIT State
102(1)
What You've Learned
102(3)
5 Unreliable Udp Communication
105(14)
Using UDP: Simple and Unreliable
106(1)
Sending and Receiving UDP Data
107(8)
Using a UDP Echo Server
107(2)
Receiving Data from the Echo Server
109(1)
Every UDP Connection Is a Listener
110(3)
Using net.Conn in UDP
113(2)
Avoiding Fragmentation
115(2)
What You've Learned
117(2)
6 Ensuring Udp Reliability
119(22)
Reliable File Transfers Using TFTP
119(1)
TFTP Types
120(11)
Read Requests
121(3)
Data Packets
124(4)
Acknowledgments
128(1)
Handling Errors
129(2)
The TFTP Server
131(4)
Writing the Server Code
131(1)
Handling Read Requests
132(3)
Starting the Server
135(1)
Downloading Files over UDP
135(4)
What You've Learned
139(2)
7 Unix Domain Sockets
141(22)
What Are Unix Domain Sockets?
142(1)
Binding to Unix Domain Socket Files
143(11)
Changing a Socket File's Ownership and Permissions
143(1)
Understanding Unix Domain Socket Types
144(10)
Writing a Service That Authenticates Clients
154(6)
Requesting Peer Credentials
154(2)
Writing the Service
156(3)
Testing the Service with Netcat
159(1)
What You've Learned
160(3)
PART III APPLICATION-LEVEL PROGRAMMING
163(104)
8 Writing Http Clients
165(22)
Understanding the Basics of HTTP
166(7)
Uniform Resource Locators
166(1)
Client Resource Requests
167(3)
Server Responses
170(2)
From Request to Rendered Page
172(1)
Retrieving Web Resources in Go
173(6)
Using Go's Default HTTP Client
173(1)
Closing the Response Body
174(2)
Implementing Time-outs and Cancellations
176(2)
Disabling Persistent TCP Connections
178(1)
Posting Data over HTTP
179(5)
Posting JSON to a Web Server
179(2)
Posting a Multipart Form with Attached Files
181(3)
What You've Learned
184(3)
9 Building Http Services
187(30)
The Anatomy of a Go HTTP Server
188(5)
Clients Don't Respect Your Time
191(1)
Adding TLS Support
192(1)
Handlers
193(9)
Test Your Handlers with httptest
195(1)
How You Write the Response Matters
196(2)
Any Type Can Be a Handler
198(2)
Injecting Dependencies into Handlers
200(2)
Middleware
202(5)
Timing Out Slow Clients
203(1)
Protecting Sensitive Files
204(3)
Multiplexers
207(2)
HTTP/2 Server Pushes
209(6)
Pushing Resources to the Client
210(4)
Don't Be Too Pushy
214(1)
What You've Learned
215(2)
10 Caddy: A Contemporary Web Server
217(24)
What Is Caddy?
218(1)
Let's Encrypt Integration
218(1)
How Does Caddy Fit into the Equation?
219(1)
Retrieving Caddy
219(1)
Downloading Caddy
219(1)
Building Caddy from Source Code
220(1)
Running and Configuring Caddy
220(4)
Modifying Caddy's Configuration in Real Time
222(2)
Storing the Configuration in a File
224(1)
Extending Caddy with Modules and Adapters
224(8)
Writing a Configuration Adapter
225(1)
Writing a Restrict Prefix Middleware Module
226(5)
Injecting Your Module into Caddy
231(1)
Reverse-Proxying Requests to a Backend Web Service
232(6)
Creating a Simple Backend Web Service
232(2)
Setting Up Caddy's Configuration
234(1)
Adding a Reverse-Proxy to Your Service
235(1)
Serving Static Files
236(1)
Checking Your Work
236(1)
Adding Automatic HTTPS
237(1)
What You've Learned
238(3)
11 Securing Communications With TLS
241(26)
A Closer Look at Transport Layer Security
242(3)
Forward Secrecy
243(1)
In Certificate Authorities We Trust
243(1)
How to Compromise TLS
244(1)
Protecting Data in Transit
245(10)
Client-side TLS
245(2)
TLS over TCP
247(2)
Server-side TLS
249(3)
Certificate Pinning
252(3)
Mutual TLS Authentication
255(10)
Generating Certificates for Authentication
256(3)
Implementing Mutual TLS
259(6)
What You've Learned
265(2)
PART IV SERVICE ARCHITECTURE
267(88)
12 Data Serialization
269(26)
Serializing Objects
270(14)
JSON
276(2)
Gob
278(2)
Protocol Buffers
280(4)
Transmitting Serialized Objects
284(10)
Connecting Services with gRPC
284(2)
Creating a TLS-Enabled gRPC Server
286(3)
Creating a gRPC Client to Test the Server
289(5)
What You've Learned
294(1)
13 Logging And Metrics
295(34)
Event Logging
296(20)
The log Package
297(3)
Leveled Log Entries
300(1)
Structured Logging
301(11)
Scaling Up with Wide Event Logging
312(3)
Log Rotation with Lumberjack
315(1)
Instrumenting Your Code
316(4)
Setup
317(1)
Counters
317(1)
Gauges
318(1)
Histograms and Summaries
319(1)
Instrumenting a Basic HTTP Server
320(6)
What You've Learned
326(3)
14 Moving To The Cloud
329(26)
Laying Some Groundwork
330(3)
AWS Lambda
333(8)
Installing the AWS Command Line Interface
333(1)
Configuring the CLI
333(2)
Creating a Role
335(1)
Defining an AWS Lambda Function
336(3)
Compiling, Packaging, and Deploying Your Function
339(1)
Testing Your AWS Lambda Function
340(1)
Google Cloud Functions
341(5)
Installing the Google Cloud Software Development Kit
341(1)
Initializing the Google Cloud SDK
341(1)
Enable Billing and Cloud Functions
342(1)
Defining a Cloud Function
342(2)
Deploying Your Cloud Function
344(1)
Testing Your Google Cloud Function
345(1)
Azure Functions
346(7)
Installing the Azure Command Line Interface
346(1)
Configuring the Azure CLI
347(1)
Installing Azure Functions Core Tools
347(1)
Creating a Custom Handler
348(1)
Defining a Custom Handler
349(1)
Locally Testing the Custom Handler
350(1)
Deploying the Custom Handler
351(2)
Testing the Custom Handler
353(1)
What You've Learned
353(2)
Index 355
Adam Woodbeck is a Senior Software Engineer at Barracuda Networks where he has implemented a distributed cloud environment in Go to supplant the previous cloud infrastructure, profoundly increasing its scalability and performance. Before his career in software engineering, Woodbeck spent time in the world of biomechanics and neurology, caring for patients as a chiropractor for nearly a decade. Adam relishes the opportunity to take a deep dive into interesting topics and distill that information into a digestible format for the benefit others.