1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
package core import ( "fmt" "net" ) func ReadConnection(conn net.Conn) { for { payload, err := Decode(conn) if err != nil { panic(err) } if err := handle(payload); err != nil { panic(err) } } } func handle(payload any) error { fmt.Println(payload) return nil }