NOTE: This implementation is likely not thread safe. I hacked it together with very little knowledge of Go's async model. I ended up going back to the JS implementation and eventually got the Rust one working, so haven't had a need to come back and flesh this one out yet.