diff options
| author | jet2tlf <jet2tlf@gmail.com> | 2024-06-03 05:09:22 +0000 |
|---|---|---|
| committer | jet2tlf <jet2tlf@gmail.com> | 2024-06-03 05:09:22 +0000 |
| commit | d66bf141966877efd877fb674e108f7db4383e66 (patch) | |
| tree | 7818ed49682328f2b707940997caa31c4edbf476 /app/main.go | |
| parent | 747d0b3ec57e31196922b7a4d512e36621cb67fc (diff) | |
| download | dns-server-go-d66bf141966877efd877fb674e108f7db4383e66.tar.gz dns-server-go-d66bf141966877efd877fb674e108f7db4383e66.zip | |
codecrafters submit [skip ci]
Diffstat (limited to 'app/main.go')
| -rw-r--r-- | app/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/main.go b/app/main.go index 46da46d..b9be1e5 100644 --- a/app/main.go +++ b/app/main.go @@ -31,7 +31,9 @@ func main() { receivedData := string(buf[:size]) fmt.Printf("Received %d bytes from %s: %s\n", size, source, receivedData) - response := []byte{} + response := make([]byte, 12) + copy(response, buf[:12]) + response[2] = flipIndicator(response[2]) _, err = udpConn.WriteToUDP(response, source) if err != nil { @@ -39,3 +41,7 @@ func main() { } } } + +func flipIndicator(b byte) byte { + return b | 0b10000000 +} |