Title Page....2
Copyright and Credits....4
Network Programming with Rust....5
Dedication....6
Packt Upsell....7
Why subscribe?....8
PacktPub.com....9
Contributors....10
About the author....11
About the reviewer....12
Packt is searching for authors like you....13
Preface....24
Who this book is for....25
What this book covers....26
To get the most out of this book....28
Download the example code files....29
Conventions used....30
Get in touch....31
Reviews....32
Introduction to Client/Server Networking....33
A brief history of networks....34
Layering in networks....36
Addressing in networks....41
How IP routing works....43
How DNS works....47
Common service models....50
Connection-oriented service....51
Connectionless service....53
The network programming interface in Linux....54
Summary....61
Introduction to Rust and its Ecosystem....62
The Rust ecosystem....64
Getting started with Rust....66
Introduction to the borrow checker....70
Generics and the trait system....76
Error handling....82
The macro system....87
Syntactic macros....88
Procedural macros....90
Functional features in Rust....91
Higher-order functions....92
Iterators....95
Concurrency primitives....98
Testing....103
Summary....106
TCP and UDP Using Rust....107
A Simple TCP server and client....108
A Simple UDP server and client....115
UDP multicasting....118
Miscellaneous utilities in std::net....120
Some related crates....122
Summary....132
Data Serialization, Deserialization, and Parsing....133
Serialization and deserialization using Serde....134
Custom serialization and deserialization....140
Parsing textual data....146
Parsing binary data....153
Summary....157
Application Layer Protocols....158
Introduction to RPC....160
Introduction to SMTP....168
Introduction to FTP and TFTP....171
Summary....175
Talking HTTP in the Internet....176
Introducing Hyper....177
Introducing Rocket....184
Introducing reqwest....201
Summary....205
Asynchronous Network Programming Using Tokio....206
Looking into the Future....207
Working with streams and sinks....215
Heading to tokio....222
Socket multiplexing in tokio....230
Writing streaming protocols....237
The larger tokio ecosystem....246
Conclusion....250
Security....251
Securing the web....252
Letsencrypt using Rust....256
OpenSSL using Rust....261
Securing tokio applications....266
Cryptography using ring....271
Summary....277
Appendix....278
Introduction to coroutines and generators....279
How May handles coroutines....283
Awaiting the future....288
Data parallelism....292
Parsing using Pest....298
Miscellaneous utilities....302
Summary....306
Other Books You May Enjoy....307
Leave a review - let other readers know what you think....309
Rust is low-level enough to provide fine-grained control over memory while providing safety through compile-time validation. This makes it uniquely suitable for writing low-level networking applications.
This book is divided into three main parts that will take you on an exciting journey of building a fully functional web server. The book starts with a solid introduction to Rust and essential networking concepts. This will lay a foundation for, and set the tone of, the entire book. In the second part, we will take an in-depth look at using Rust for networking software. From client-server networking using sockets to IPv4/v6, DNS, TCP, UDP, you will also learn about serializing and deserializing data using serde. The book shows how to communicate with REST servers over HTTP. The final part of the book discusses asynchronous network programming using the Tokio stack. Given the importance of security for modern systems, you will see how Rust supports common primitives such as TLS and public-key cryptography.
After reading this book, you will be more than confident enough to use Rust to build effective networking software.
This book is for software developers who want to write networking software with Rust. A basic familiarity with networking concepts is assumed. Beginner-level knowledge of Rust will help but is not necessary.