initial commit

This commit is contained in:
iceBear67
2026-07-15 14:28:58 +08:00
commit 6e0d7ec33f
47 changed files with 4022 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
// Command redapricot-client runs the Go client that registers routing patterns
// with a redapricot hub and forwards player traffic to real destinations.
package main
import (
"context"
"flag"
"log"
"os/signal"
"syscall"
"github.com/iceBear67/redapricot/client"
)
func main() {
flag.Parse()
args := flag.Args()
if len(args) < 1 {
log.Fatal("usage: redapricot-client <config.json>")
}
cfg, err := client.LoadConfig(args[0])
if err != nil {
log.Fatalf("config: %v", err)
}
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
c := client.New(cfg)
if err := c.Start(ctx); err != nil {
log.Fatalf("start: %v", err)
}
log.Printf("redapricot client running; %d mapping(s) registered", len(cfg.Mappings))
<-ctx.Done()
log.Printf("shutting down")
c.Close()
}