{"id":21423826,"url":"https://github.com/ossystems/cdn","last_synced_at":"2025-07-14T08:31:28.003Z","repository":{"id":137551516,"uuid":"144012307","full_name":"OSSystems/cdn","owner":"OSSystems","description":"Multi-protocol Caching Layer for any HTTP storage backend","archived":false,"fork":false,"pushed_at":"2024-01-08T21:25:24.000Z","size":127,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-03T08:07:37.584Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OSSystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-08-08T12:43:41.000Z","updated_at":"2024-11-30T06:12:07.000Z","dependencies_parsed_at":"2024-01-08T15:39:35.780Z","dependency_job_id":null,"html_url":"https://github.com/OSSystems/cdn","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/OSSystems/cdn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Fcdn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Fcdn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Fcdn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Fcdn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OSSystems","download_url":"https://codeload.github.com/OSSystems/cdn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSystems%2Fcdn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265262601,"owners_count":23736427,"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-11-22T21:18:24.370Z","updated_at":"2025-07-14T08:31:27.715Z","avatar_url":"https://github.com/OSSystems.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg align=\"center\" src=\"docs/logo.png\" height=\"200px\"/\u003e\n\u003c/p\u003e\n\n# cdn\n\n*Multi-protocol Caching Layer for any HTTP backend*\n\nThis project aims to provide an caching layer for any HTTP backend, e.g. Amazon S3.\n\n\u003cp align=\"center\"\u003e\n   \u003cimg align=\"center\" src=\"docs/diagram.png\"/\u003e\n\u003c/p\u003e\n\n## Usage\n\n```\n$ ./cdn --help\nUsage:\n  cdn [flags]\n\nFlags:\n      --cache string     Path will be cached\n      --backend string   Backend HTTP server URL\n      --coap string      CoAP listen address (default \"0.0.0.0:5683\")\n      --db string        Database file (default \"state.db\")\n  -h, --help             help for cdn\n      --http string      HTTP listen address (default \"0.0.0.0:8080\")\n      --log string       Log level (debug, info, warn, error, fatal, panic) (default \"info\")\n      --monitor string   Monitor plugin\n      --size int         Max storage size in bytes (-1 for unlimited) (default -1)\n      --storage string   Storage dir (default \"./\")\n```\n\nExample:\n\n```\n./cdn --backend http://localhost:8000 --monitor samplemonitor/samplemonitor.so\n```\n\n## Monitor plugin\n\nTo create your own monitor plugin you must implement the following `Monitor` interface:\n\n```go\ntype Monitor interface {\n        Init()\n        RecordMetric(protocol, path, addr string, transferred, size int64, timestamp time.Time)\n}\n```\n\nSee [samplemonitor/monitor.go](samplemonitor/monitor.go) for an working example of monitor plugin implementation.\n\nTo build the plugin use:\n\n```\n$ cd samplemonitor\n$ go build -buildmode=plugin\n```\n\n## Client usage\n\nCurrently HTTP and CoAP protocols are supported. By default the HTTP server listen on `0.0.0.0:8080` and the CoAP listen on `0.0.0.0:5683`.\n\nWhen a request is made to cdn server the storage cache search for requested path, if the requested path is not found in storage cache then the requested patch is fetched from remote backend, otherwise the file is served from directly from storage cache. This means that you can send a `GET` request directly to cdn server instead of remote backend.\n\nLet's suppose that you have a file `archive.tar.gz` stored in a bucket on Amazon S3 (http://yourbucket.s3.amazonaws.com) and started the cdn server setting the backend address to your bucket address.\n\nThe `archive.tar.gz` will be available in:\n\n* `http://localhost:8080/archive.tar.gz`\n* `coap://localhost:5683/archive.tar.gz`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossystems%2Fcdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossystems%2Fcdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossystems%2Fcdn/lists"}