zoo daemon sends package list over wire

man. long live google protobuf. It's amazing. This
	thing just sent all 3k of the package info over http in raw
	wire format. I'm sure this isn't neat to anyone young but
	to old hacks like me, it's fucking magic how wonderfully
	advanced the language and codebase is. It just reminds
	you how there are actually beautiful things in the world.
This commit is contained in:
Jeff Carr 2024-11-15 19:49:48 -06:00
parent 9d265e0445
commit 141d3024fd
1 changed files with 10 additions and 1 deletions

11
http.go
View File

@ -6,6 +6,7 @@ import (
"net/http"
"strings"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
)
@ -37,7 +38,15 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("hostname was blank")
return
}
log.Info("Got URL msg length:", len(msg))
var packs *zoopb.Packages
packs = new(zoopb.Packages)
if err := packs.Unmarshal(msg); err != nil {
log.Info("proto.Unmarshal() failed on wire message len", len(msg), "from", hostname)
return
}
log.Info("Unmarshal worked with msg len", len(msg), "from", hostname)
log.Info(hostname, "has", packs.Len(), "packages installed")
return
}