aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcodecrafters-bot <hello@codecrafters.io>2024-06-02 19:01:13 +0000
committercodecrafters-bot <hello@codecrafters.io>2024-06-02 19:01:13 +0000
commita8b4c90518bbb7e45026e0fca13e2f2f97f2c728 (patch)
treebc9eea631ddbd4cbcc7c1d331b78e4993f975089 /app
downloaddns-server-go-a8b4c90518bbb7e45026e0fca13e2f2f97f2c728.tar.gz
dns-server-go-a8b4c90518bbb7e45026e0fca13e2f2f97f2c728.zip
init [skip ci]
Diffstat (limited to 'app')
-rw-r--r--app/main.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/app/main.go b/app/main.go
new file mode 100644
index 0000000..36c8519
--- /dev/null
+++ b/app/main.go
@@ -0,0 +1,48 @@
+package main
+
+import (
+ "fmt"
+ // Uncomment this block to pass the first stage
+ // "net"
+)
+
+func main() {
+ // You can use print statements as follows for debugging, they'll be visible when running tests.
+ fmt.Println("Logs from your program will appear here!")
+
+ // Uncomment this block to pass the first stage
+ //
+ // udpAddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:2053")
+ // if err != nil {
+ // fmt.Println("Failed to resolve UDP address:", err)
+ // return
+ // }
+ //
+ // udpConn, err := net.ListenUDP("udp", udpAddr)
+ // if err != nil {
+ // fmt.Println("Failed to bind to address:", err)
+ // return
+ // }
+ // defer udpConn.Close()
+ //
+ // buf := make([]byte, 512)
+ //
+ // for {
+ // size, source, err := udpConn.ReadFromUDP(buf)
+ // if err != nil {
+ // fmt.Println("Error receiving data:", err)
+ // break
+ // }
+ //
+ // receivedData := string(buf[:size])
+ // fmt.Printf("Received %d bytes from %s: %s\n", size, source, receivedData)
+ //
+ // // Create an empty response
+ // response := []byte{}
+ //
+ // _, err = udpConn.WriteToUDP(response, source)
+ // if err != nil {
+ // fmt.Println("Failed to send response:", err)
+ // }
+ // }
+}