usersession is a simple way to keep track of user information on a Go API.
it assigns a session ID and gives you a place to store the IP and some user config information for user verification if you want. You can use the session ID and/or IP address to keep track of who's doing what on your API from a central log. Expand it with the necessary attributes you need for your application.
Consider a cleanup function if you need to do resource management with defer usersession.PerformCleanup()
. This isn't implemented here, but you get the idea.