{"id":20003563,"url":"https://github.com/nathanborror/gommon","last_synced_at":"2026-05-06T16:18:13.824Z","repository":{"id":66667385,"uuid":"21211498","full_name":"nathanborror/gommon","owner":"nathanborror","description":"Some common packages used in Go projects","archived":false,"fork":false,"pushed_at":"2015-07-06T23:11:49.000Z","size":293,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T00:27:03.672Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nathanborror.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-25T17:05:03.000Z","updated_at":"2018-11-26T15:50:34.000Z","dependencies_parsed_at":"2023-02-20T17:00:45.604Z","dependency_job_id":null,"html_url":"https://github.com/nathanborror/gommon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nathanborror/gommon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fgommon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fgommon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fgommon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fgommon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanborror","download_url":"https://codeload.github.com/nathanborror/gommon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanborror%2Fgommon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32701685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T05:26:13.142Z","updated_at":"2026-05-06T16:18:13.808Z","avatar_url":"https://github.com/nathanborror.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gommon toolkit\n\nGommon is a set of packages for quickly prototyping Go applications.\n**This stuff is very new and subject to lots of iteration. Feel free to look\nand riff but don't expect any sort of stability.**\n\n\n#### Auth\n\nAuth is a simple and dumb way to store and authenticate users. It builds on the\nGorilla toolkit's sessions package (http://www.gorillatoolkit.org/pkg/sessions)\nand uses SQLite to store user information. Please note, passwords are currently\nstored in a very insecure fashion.\n\n\n#### Render\n\nRender is a collection of basic functions that help render template output.\nIf the request is an XHR request it will return a JSON response instead\nof rendering it's given template. You can also append `?json` to any URL to\nforce a JSON response.\n\n\n#### Spokes\n\nSpokes is a basic WebSocket pub/sub implemetation using the Gorilla WebSocket\ntoolkit. It's based off the [chat example](https://github.com/gorilla/websocket/tree/master/examples/chat)\nbut adds a simple strategy that allows clients to subscribe to urls and receive\nupdates when requests are made by other clients making changes.\n\nTo setup spokes do the following in your project:\n\n``` go\nimport (\n  \"net/http\"\n  \"os\"\n\t\"github.com/nathanborror/gommon/spokes\"\n)\n\nfunc main() {\n\tgo spokes.Hub.Run()\n\n  http.Handle(\"/ws\", spokes.SpokeHandler)\n\n  err := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n}\n```\n\nThen use the provided javascript to interact with the WebSocket.\n\n\n#### Tokens\n\nTokens is a package for storing push tokens about any devies an auth.User\nmay have. It currently uses [github.com/anachronistic/apns](github.com/anachronistic/apns)\nfor sending push notifications to iOS devices.\n\nJust add the http handler like so:\n\n``` go\nimport (\n  \"net/http\"\n  \"os\"\n  \"github.com/nathanborror/gommon/tokens\"\n)\n\nfunc main() {\n  http.Handle(\"/t/save\", tokens.SaveHandler)\n\n  err := http.ListenAndServe(\":8080\", nil)\n  if err != nil {\n    os.Exit(1)\n  }\n}\n```\n\nThen in your handler create a list of auth.User.Key and pass it into the\ntokenRepo.Push method to send the message to APNS servers. Be sure to put\nyour push certificate and key in the root directory of your project. You can use\n[this tutorial](http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1)\nto setup your iOS push stuff.\n\n``` go\nimport (\n  \"net/http\"\n  \"github.com/nathanborror/gommon/tokens\"\n)\n\nvar tokenRepo = tokens.SqlRepository()\nvar authRepo = auth.SqlRepository()\n\nfunc yourHandler() {\n  users, err := authRepo.List(100)\n  if err != nil {\n    panic(err)\n  }\n\n  ul := []string{}\n  for _, u := range users {\n    ul = append(ul, u.Key)\n  }\n\n  err = tokenRepo.Push(users, \"Your push message\", \"YourCert.pem\", \"YourKey.pem\")\n  if err != nil {\n    panic(err)\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanborror%2Fgommon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanborror%2Fgommon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanborror%2Fgommon/lists"}