Skip to content

Commit

Permalink
2024-09-29 17:56:33
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Sep 29, 2024
1 parent d3a7a0c commit f2d1a46
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions protocol/etch/engine.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package etch

import (
"log"
"net"

"github.com/mohanson/daze/lib/doa"
)

type Server struct {
Listen string
}

func (s *Server) Run() error {
addr := doa.Try(net.ResolveUDPAddr("udp", s.Listen))
conn := doa.Try(net.ListenUDP("udp", addr))
buf := make([]byte, 512)
for {
n, addr, err := conn.ReadFromUDP(buf)
if err != nil {
break
}
log.Println(addr, buf[:n])
}
return nil
}

0 comments on commit f2d1a46

Please sign in to comment.