Feat: works on my machine

This commit is contained in:
2025-10-16 05:07:56 +08:00
commit ce3af7c682
37 changed files with 4537 additions and 0 deletions

38
test.go Normal file
View File

@@ -0,0 +1,38 @@
package main
import (
"gitea.konchin.com/ytshih/inp2025/utils"
"github.com/spf13/cobra"
)
var testCmd = &cobra.Command{
Use: "test",
}
var testServerCmd = &cobra.Command{
Use: "server",
Run: func(cmd *cobra.Command, args []string) {
dataCh := make(chan string)
_, shutdown, err := utils.ListenUDPData(18787, dataCh)
if err != nil {
panic(err)
}
defer shutdown()
<-dataCh
},
}
var testClientCmd = &cobra.Command{
Use: "client",
Run: func(cmd *cobra.Command, args []string) {
err := utils.Ping("localhost:18787")
if err != nil {
panic(err)
}
},
}
func init() {
testCmd.AddCommand(testServerCmd)
testCmd.AddCommand(testClientCmd)
}