{"id":13494470,"url":"https://github.com/ysmood/digto","last_synced_at":"2025-05-12T13:50:59.889Z","repository":{"id":51544335,"uuid":"227362260","full_name":"ysmood/digto","owner":"ysmood","description":"A service to expose HTTP service to the public network","archived":false,"fork":false,"pushed_at":"2021-05-11T09:49:01.000Z","size":311,"stargazers_count":57,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-25T13:56:24.245Z","etag":null,"topics":["http-proxy","https-proxy","proxy","reverse-proxy"],"latest_commit_sha":null,"homepage":"https://digto.org","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ysmood.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-11T12:35:46.000Z","updated_at":"2025-04-22T05:17:19.000Z","dependencies_parsed_at":"2022-08-22T05:41:51.590Z","dependency_job_id":null,"html_url":"https://github.com/ysmood/digto","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysmood%2Fdigto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysmood%2Fdigto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysmood%2Fdigto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysmood%2Fdigto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysmood","download_url":"https://codeload.github.com/ysmood/digto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253752545,"owners_count":21958728,"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":["http-proxy","https-proxy","proxy","reverse-proxy"],"created_at":"2024-07-31T19:01:25.347Z","updated_at":"2025-05-12T13:50:59.830Z","avatar_url":"https://github.com/ysmood.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Digto\n\n[![GoDoc](https://godoc.org/github.com/ysmood/digto?status.svg)](https://godoc.org/github.com/ysmood/digto)\n[![codecov](https://codecov.io/gh/ysmood/digto/branch/master/graph/badge.svg)](https://codecov.io/gh/ysmood/digto)\n[![goreport](https://goreportcard.com/badge/github.com/ysmood/digto)](https://goreportcard.com/report/github.com/ysmood/digto)\n\nA service to help to expose HTTP/HTTPS service to the public network.\nThe interface is designed to be easily programmable.\nFor example you can use `curl` command only to serve public https request without any other dependency.\n\n## Proxy a local port\n\n1. Install the client: `curl -L https://git.io/fjaxx | repo=ysmood/digto sh`\n\n1. Run `digto my-domain :8080` to proxy `https://my-domain.digto.org` to port 8080\n\n### Use `curl` only to handle a request\n\nOpen a terminal to send the request:\n\n```bash\ncurl https://my-subdomain.digto.org/path -d 'ping'\n# pong\n```\n\n`my-subdomain` can be anything you want. As you can see the request will hang until we send a response back.\nLet's open a new terminal to send the response for it:\n\n```bash\ncurl -i https://digto.org/my-subdomain\n# HTTP/2 200\n# digto-method: GET\n# digto-url: /path\n# digto-id: 3dd4e560\n#\n# ping\n\n# the value of digto-id header must be the same as the previous one\ncurl https://digto.org/my-subdomain -H 'digto-id: 3dd4e560' -d 'pong'\n```\n\nAfter we send the response the previous terminal will print `pong`.\n\n### Go\n\n```go\npackage main\n\nimport (\n    \"bytes\"\n    \"fmt\"\n    \"github.com/ysmood/digto/client\"\n    \"io/ioutil\"\n)\n\nfunc main() {\n    c := client.New(\"my-subdomain\")\n\n    req, res, _ := c.Next()\n\n    data, _ := ioutil.ReadAll(req.Body)\n    fmt.Println(string(data)) // output \"my-data\"\n\n    res(200, nil, bytes.NewBufferString(\"it works\"))\n\n    // curl https://my-subdomain.digto.org -d my-data\n    // output \"it works\"\n}\n```\n\n### Node.js\n\n```js\nconst digto = require('digto')\n\n;(async() =\u003e {\n    const c = digto({ subdomain: 'my-subdomain' })\n\n    const [res, send] = await c.next()\n\n    console.log(res) // # output \"my-data\"\n\n    await send({ body: 'it works' })\n\n    // curl https://my-subdomain.digto.org -d my-data\n    // output \"it works\"\n})()\n```\n\n### Ruby\n\n```ruby\nrequire 'digto'\n\nc = Digto::Client.new 'my-subdomain'\n\ns = c.next\n\nputs s.body.to_s # output \"my-data\"\n\ns.response(200, {}, body: 'it works')\n\n# curl https://my-subdomain.digto.org -d my-data\n# output \"it works\"\n```\n\n## API\n\nA OAuth sequence diagram example:\n\n![diagram](doc/digto_sequence_diagram.svg)\n\nThe only dependency for a language to implement a client is an HTTP lib.\nUsually, the client code can be only a few lines of code. This is nice to become part of an auto-testing.\nSuch as the integration test of OAuth and payment callbacks.\n\n### GET `/{subdomain}`\n\nGet the request data from the public.\n\nThe response is standard http response with 3 extra headers prefixed with `Digto` like:\n\n```text\nHTTP/1.1 200 OK\nDigto-ID: {id}\nDigto-Method: POST\nDigto-URL: /callback\nOther-Headers: value\n\n\u003cbinary body\u003e\n```\n\nDigto will proxy the rest headers transparently.\n\n### POST `/{subdomain}`\n\nSend the response data back to the public.\n\nThe request should be standard HTTP request with 2 extra headers prefixed with `Digto` like:\n\n```text\nPOST /test HTTP/1.1\nDigto-ID: {id}\nDigto-Status: 200\nYour-Own-Headers: value\n\n\u003cbinary body\u003e\n```\n\nThe `{id}` is required, you have to send back the `{id}` from the previous response.\n\n### Error\n\nIf a protocol-level error happens the response will have the `Digto-Error: reason` header to report the reason.\n\n## Setup private digto server\n\nYou can use my [demo server](https://digto.org) for free, you can also setup your own.\n\nInstall server: `curl -L https://git.io/fjaxx | repo=ysmood/digto sh`\n\nFor help run `digto --help`.\n\nThis project helps to handle the boring part of the proxy server, such automatically obtain and renew the https certificate.\nSo that all you need is to have the permission of the DNS provider and run the server like the example below.\n\nExample to serve `digto serve --dns-config {token} --host test.com`\n\nThe server will add two records on your DNS provider, one is like `@.test.com 1.2.3.4`,\nthe other one with a wildcard like `*.test.com 1.2.3.4`.\n\nFor now only [dnspod](https://www.dnspod.com/?lang=en) is supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysmood%2Fdigto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysmood%2Fdigto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysmood%2Fdigto/lists"}