aboutsummaryrefslogtreecommitdiff
path: root/app/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.go')
-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)
+ // }
+ // }
+}