Thanks for peeking -- so server.go
is the actual API server -- all it does is
spit out some json with a t/f and flips it each hit. proxy.go
is the meat.
I'll explain it below. client.go
, like server.go
is just something to
exercise the proxy more or less.
the proxy takes a request the first time, and forwards it along to the server.
it then caches the result for up to CacheExpiration
seconds and only hits it
every TickTime
seconds. The point of this is to offload frequently hit but
infrequently changing requests for API services, such as EC2's instance status
API.
I plan on making this into a library once I get a firmer grip on Go.
What I really want is a good solid look at my goroutine and channel usage -- the API and error handling in particular don't concern me as much right now, but the concurrency does, and what I can do to make it better.
fwiw, I'm aware the code is pretty ugly -- it's about the usage patterns right now for me. This is very much "beat on it until it works" code atm.