Skip to main content

2017 | Buch

Network Programming with Go

Essential Skills for Using and Securing Networks

insite
SUCHEN

Über dieses Buch

Dive into key topics in network architecture and Go, such as data serialization, application level protocols, character sets and encodings. This book covers network architecture and gives an overview of the Go language as a primer, covering the latest Go release.
Beyond the fundamentals, Network Programming with Go covers key networking and security issues such as HTTP and HTTPS, templates, remote procedure call (RPC), web sockets including HTML5 web sockets, and more.
Additionally, author Jan Newmarch guides you in building and connecting to a complete web server based on Go. This book can serve as both as an essential learning guide and reference on Go networking.

What You Will LearnMaster network programming with Go
Carry out data serialization
Use application-level protocols
Manage character sets and encodings
Deal with HTTP(S)
Build a complete Go-based web server
Work with RPC, web sockets, and more


Who This Book Is For
Experienced Go programmers and other programmers with some experience with the Go language.

Inhaltsverzeichnis

Frontmatter
Chapter 1. Architecture
Abstract
This chapter covers the major architectural features of distributed systems. You can't build a system without some idea of what you want to build. And you can't build it if you don't know the environment in which it will work. GUI programs are different than batch processing programs; games programs are different than business programs; and distributed programs are different than standalone programs. They each have their approaches, their common patterns, the problems that typically arise, and the solutions that are often used.
Jan Newmarch
Chapter 2. Overview of the Go Language
Abstract
There is a continual stream of programming languages being invented. Some are highly specialized, others are quite generic, while a third group is designed to fill broad but to some extent niche areas. Go was created in 2007 and released publically in 2009. It was intended to be a systems programming language, augmenting (or replacing) C++ and other statically compiled languages for production network and multiprocessing systems.
Jan Newmarch
Chapter 3. Socket-Level Programming
Abstract
There are many kinds of networks in the world. These range from the very old networks, such as serial links, through to wide area networks made from copper and fiber, to wireless networks of various kinds, both for computers and for telecommunications devices such as phones. These networks obviously differ at the physical link layer, but in many cases they also differ at higher layers of the OSI stack.
Jan Newmarch
Chapter 4. Data Serialization
Abstract
A client and server need to exchange information via messages. TCP and UDP provide the transport mechanisms to do this. The two processes also need to have a protocol in place so that message exchange can take place meaningfully.
Jan Newmarch
Chapter 5. Application-Level Protocols
Abstract
A client and server need to exchange information via messages. TCP and UDP provide the transport mechanisms to do this. The two processes also need to have a protocol in place so that message exchange can take place meaningfully. A protocol defines what type of conversation can take place between two components of a distributed application, by specifying messages, data types, encoding formats, and so on. This chapter looks at some of the issues involved in this process and gives a complete example of a simple client-server application.
Jan Newmarch
Chapter 6. Managing Character Sets and Encodings
Abstract
Once upon a time, there was EBCDIC and ASCII. Actually, it was never that simple and has just become more complex over time. There is light on the horizon, but some estimates are that it may be 50 years before we all live in the daylight on this!
Jan Newmarch
Chapter 7. Security
Abstract
Although the Internet was originally designed as a system to withstand attacks by hostile agents, it developed into a cooperative environment of relatively trusted entities. Alas, those days are long gone. Spam mail, denial of service (DoS) attacks, phishing attempts, and so on are indicative that anyone using the Internet does so at their own risk.
Jan Newmarch
Chapter 8. HTTP
Abstract
The World Wide Web is a major distributed system, with millions of users. A site may become a web host by running an HTTP server. While web clients are typically users with a browser, there are many other "user agents" such as web spiders, web application clients, and so on.
Jan Newmarch
Chapter 9. Templates
Abstract
Most server-side languages have a mechanism for taking predominantly static pages and inserting a dynamically generated component, such as a list of items. Typical examples are scripts in Java Server Pages, PHP scripting, and many others. Go has adopted a relatively simple scripting language in the template package.
Jan Newmarch
Chapter 10. A Complete Web Server
Abstract
This chapter is principally an illustration of the HTTP chapter, building a complete Web server in Go. It also shows how to use templates in order to use expressions in text files to insert variable values and to generate repeated sections. It deals with serialized data and Unicode character sets.
Jan Newmarch
Chapter 11. HTML
Abstract
The Web was originally created to serve HTML documents. Now it is used to serve all sorts of documents as well as data of different kinds. Nevertheless, HTML is still the main document type delivered over the Web.
Jan Newmarch
Chapter 12. XML
Abstract
XML is a significant markup language mainly intended as a means of representing structured data using a text format. In the language we used in Chapter 4, it can be considered as a means of serializing data structures as a text document. It is used to describe documents such as DocBook and XHTML. It is used in specialized markup languages such as MathML and CML (Chemistry Markup Language). It is used to encode data as SOAP messages for Web Services, and the Web Service can be specified using WSDL (Web Services Description Language).
Jan Newmarch
Chapter 13. Remote Procedure Call
Abstract
Socket and HTTP programming both use a message-passing paradigm. A client sends a message to a server, which usually sends a message back. Both sides are responsible for creating messages in a format understood by both sides, and in reading the data out of those messages.
Jan Newmarch
Chapter 14. REST
Abstract
In previous chapters we looked at HTTP and gave an example of a web system. However, we didn't give any particular structure to the system, just what was simple enough for the problem.
Jan Newmarch
Chapter 15. WebSockets
Abstract
In the case of a browser, the request is made by clicking on a link, entering a URL into the address bar, clicking on the forward or back buttons, etc. The response is treated as a new page and is loaded into a browser window.
Jan Newmarch
Backmatter
Metadaten
Titel
Network Programming with Go
verfasst von
Jan Newmarch
Copyright-Jahr
2017
Verlag
Apress
Electronic ISBN
978-1-4842-2692-6
Print ISBN
978-1-4842-2691-9
DOI
https://doi.org/10.1007/978-1-4842-2692-6

Premium Partner