Software Development with Go: Cloud-Native Programming using Golang with Linux and Docker by Nanik Tolaram

Software Development with Go: Cloud-Native Programming using Golang with Linux and Docker by Nanik Tolaram

Author:Nanik Tolaram
Language: eng
Format: epub
ISBN: 9781484287316
Publisher: Apress


func (s *Server) readRequest() (dnsmessage.Message, *net.UDPAddr, error) {

buf := make([]byte, 1024)

_, addr, err := s.conn.ReadFromUDP(buf)

...

}

The readRequest() function, on receiving the incoming request, proceeds to unpack the data using the built-in golang.org/x/n/dns package, as shown here:func (s *Server) readRequest() (dnsmessage.Message, *net.UDPAddr, error) {

...

var msg dnsmessage.Message

err = msg.Unpack(buf)

...

}

The unpacked data is now stored in a dnsmessage.Message struct that has the following declaration:type Message struct {

Header

Questions []Question

Answers []Resource

Authorities []Resource

Additionals []Resource

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.