{"id":13771295,"url":"https://github.com/jackdoe/net-gemini","last_synced_at":"2025-05-11T03:33:09.780Z","repository":{"id":41279160,"uuid":"264268803","full_name":"jackdoe/net-gemini","owner":"jackdoe","description":"gemini server - gemini://gemini.circumlunar.space/ (https://gemini.circumlunar.space/)","archived":false,"fork":false,"pushed_at":"2021-08-25T21:13:53.000Z","size":13,"stargazers_count":30,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-17T06:40:41.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/jackdoe.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-15T18:25:45.000Z","updated_at":"2024-06-18T15:41:28.000Z","dependencies_parsed_at":"2022-08-10T01:43:29.476Z","dependency_job_id":null,"html_url":"https://github.com/jackdoe/net-gemini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fnet-gemini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fnet-gemini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fnet-gemini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fnet-gemini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackdoe","download_url":"https://codeload.github.com/jackdoe/net-gemini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514352,"owners_count":21920327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-08-03T17:00:49.966Z","updated_at":"2025-05-11T03:33:09.549Z","avatar_url":"https://github.com/jackdoe.png","language":"Go","funding_links":[],"categories":["Servers"],"sub_categories":["Graphical"],"readme":"package gemini // import \"github.com/jackdoe/net-gemini\"\n\ngemini server implementation, check out gemini://gemini.circumlunar.space/\ninspired by https://tildegit.org/solderpunk/molly-brown\n\nExample:\n\n     package main\n\n     import (\n     \t\"log\"\n\n     \tgemini \"github.com/jackdoe/net-gemini\"\n     )\n\n     func main() {\n    \tgemini.HandleFunc(\"/example\", func(w *gemini.Response, r *gemini.Request) {\n    \t\tif len(r.URL.RawQuery) == 0 {\n    \t\t\tw.SetStatus(gemini.StatusInput, \"what is the answer to the ultimate question\")\n    \t\t} else {\n    \t\t\tw.SetStatus(gemini.StatusSuccess, \"text/gemini\")\n    \t\t\tanswer := r.URL.RawQuery\n    \t\t\tw.Write([]byte(\"HELLO: \" + r.URL.Path + \", yes the answer is: \" + answer))\n    \t\t}\n    \t})\n\n    \tgemini.Handle(\"/\", gemini.FileServer(*root))\n     \tlog.Fatal(gemini.ListenAndServeTLS(\"localhost:1965\", \"localhost.crt\", \"localhost.key\"))\n     }\n\nYou can also checkout cmd/main.go as an example.\n\nMake sure to generate your cert for localhost:\n\n    openssl req \\\n            -x509 \\\n            -out localhost.crt \\\n            -keyout localhost.key \\\n            -newkey rsa:2048 \\\n            -nodes \\\n            -sha256 \\\n            -subj '/CN=localhost' \\\n            -extensions EXT \\\n            -config \u003c( printf \"[dn]\\nCN=localhost\\n[req]\\ndistinguished_name = dn\\n[EXT]\\nsubjectAltName=DNS:localhost\\nkeyUsage=digitalSignature\\nextendedKeyUsage=serverAuth\")\n\nCONSTANTS\n\nconst (\n\tStatusInput                              = 10\n\tStatusSuccess                            = 20\n\tStatusSuccessEndClientCertificateSession = 21\n\tStatusRedirectTemporary                  = 30\n\tStatusRedirectPermanent                  = 31\n\tStatusTemporaryFailure                   = 40\n\tStatusServerUnavailable                  = 41\n\tStatusCGIError                           = 42\n\tStatusProxyError                         = 43\n\tStatusSlowDown                           = 44\n\tStatusPermanentFailure                   = 50\n\tStatusNotFound                           = 51\n\tStatusGone                               = 52\n\tStatusProxyRequestRefused                = 53\n\tStatusBadRequest                         = 59\n\tStatusClientCertRequired                 = 60\n\tStatusTransientCertRequested             = 61\n\tStatusAuthorisedCertRequired             = 62\n\tStatusCertNotAccepted                    = 63\n\tStatusFutureCertRejected                 = 64\n\tStatusExpiredCertRejected                = 65\n)\n\nFUNCTIONS\n\nfunc Handle(p string, h Handler)\nfunc HandleFunc(p string, f HandlerFunc)\nfunc ListenAndServeTLS(addr string, certFile, keyFile string) error\nfunc ServeFilePath(p string, w *Response, r *Request)\n\nTYPES\n\ntype Handler interface {\n\tServeGemini(*Response, *Request)\n}\n\nfunc FileServer(root string) Handler\n\ntype HandlerFunc func(*Response, *Request)\n\nfunc (f HandlerFunc) ServeGemini(w *Response, r *Request)\n\ntype Request struct {\n\tURL *url.URL\n}\n\ntype Response struct {\n\t// Has unexported fields.\n}\n\nfunc (r *Response) SetStatus(s Status, mime string) error\n\nfunc (r *Response) Write(b []byte) (int, error)\n\ntype Server struct {\n\tAddr         string\n\tHandler      Handler\n\tReadTimeout  time.Duration\n\tWriteTimeout time.Duration\n\n\tLog io.Writer\n\t// Has unexported fields.\n}\n\nfunc (s *Server) Close()\n\nfunc (s *Server) ListenAndServeTLS(certFile, keyFile string) error\n\ntype Status int\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdoe%2Fnet-gemini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdoe%2Fnet-gemini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdoe%2Fnet-gemini/lists"}