September 2017
Intermediate to advanced
466 pages
9h 33m
English
This subsection will process a log file that contains client IP addresses in order to create a summary of them. The name of the Go file will be countIP.go, and it will be presented in four parts. Note that countIP.go requires two parameters: the name of the log file and the field that contains the desired information. As countIP.go does not check whether the given field contains an IP address or not, it can also be used for other kinds of data if you remove some of its code.
First, you will see the expected preamble of the program:
package main import ( "bufio" "flag" "fmt" "io" "net" "os" "path/filepath" "strings" )
The second part comes with the following Go code, which is the beginning of the implementation of the ...
Read now
Unlock full access