{"id":27334840,"url":"https://github.com/dmuth/procedural-webserver","last_synced_at":"2025-04-12T14:46:28.773Z","repository":{"id":8782809,"uuid":"10471748","full_name":"dmuth/procedural-webserver","owner":"dmuth","description":"A webserver written in GoLang which serves up procedurally generated content.","archived":false,"fork":false,"pushed_at":"2020-09-03T22:22:09.000Z","size":52,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-19T16:46:08.810Z","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/dmuth.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":"2013-06-04T05:42:22.000Z","updated_at":"2019-08-19T05:29:58.000Z","dependencies_parsed_at":"2022-08-28T22:12:28.587Z","dependency_job_id":null,"html_url":"https://github.com/dmuth/procedural-webserver","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/dmuth%2Fprocedural-webserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fprocedural-webserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fprocedural-webserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fprocedural-webserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmuth","download_url":"https://codeload.github.com/dmuth/procedural-webserver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248585233,"owners_count":21128969,"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":"2025-04-12T14:46:28.220Z","updated_at":"2025-04-12T14:46:28.757Z","avatar_url":"https://github.com/dmuth.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Procedural Webserver\n\nA webserver written in Google Go which serves up procedurally generated content.\n\nI built this for a webcrawler which I am working on--I did not want to test \nit out by hamming the same set of websites over and over (as I am sure the\nowners would not appreciate that) so I instead wrote this webserver to serve \nup content which is generated procedurally.  That way, I can hammer it with my \nweb crawler yet still get unique pages generated with little memory usage.\n\n### Installation\n\n- Make sure your golib is set up properly: `export GOLIB=$HOME/golib`\n- Make sure the bin directory is in your path: `PATH=$PATH:$GOLIB/bin`\n- To install just the package:\n    - `go get -v github.com/dmuth/procedural-webserver`\n- To install the CLI:\n    - `go get -v github.com/dmuth/procedural-webserver/procedural-webserver-cli`\n\n### Usage from the command line\n\n`$GOLIB/bin/procedural-webserver-cli`\n\nThis wil start a webserver listening on at http://localhost:8080/\n\n#### Syntax\n\n    procedural-webserver-cli --debug-level level --num-links-min n --num-links-max n --num-images-min n --num-images-max n --port portnum --seed string\n        -port=8080: Port to listen on\n        -debug-level=\"info\": Set the debug level\n        -num-links-min=1: Minimum number of links per page\n        -num-links-max=10: Maximum number of links per page\n        -num-images-min=1: Minimum number of images per page\n        -num-images-max=10: Maximum number of images per page\n        -seed=\"test_seed\": Seed to use for random values\n\n\n#### From another app\n\nTo use this in your app, you'd want Go code that looks like this:\n\n    import server \"github.com/dmuth/procedural-webserver\"\n\n    func main() {\n        server_object := server.NewServer(port, NumLinksMin, NumLinksMax, NumImagesMin, NumImagesMax, Seed)\n        go server_object.Start() // Start the webserver\n        // do stuff\n        server_object.Stop() // Stop the webserver\n    }\n\n- NumLinksMin: Min number of links. (actual number of created images is somewhere between min and max)\n- NumLinksMax: Max number of links listed on each generated page. (links bring up more procedurally generated content)\n- NumImagesMin: Min number of images. (actual number of created images is somewhere between min and max)\n- NumImagesMax: Max number of images listed on each generated page. (they're not really images)\n- Seed: Our base seed. If not specified, a default is used.  If specified, this changes the content of \nall pages. If you understand how Minecraft world seeds work, this is the same concept.\n    \n\n### Query parameters\n\nThe following query parameters will have effects on the page that is generated:\n\n- code=num - This will force the websever to return a specific HTTP code.  \n    `code=404` will return a 404, for example.\n- delay=num How long to delay loading a page for.  Useful for simulating network lag\n    - Example times: \n        - 100ms\n        - 2s\n        - 5m\n        - 1h (Yes, this is an hour.  Google Go doesn't care. But Curl might!)\n \n### Running the tests\n\n    go test -v github.com/dmuth/procedural-webserver\n\nYou should see results like this:\n\n    === RUN TestStringN\n    --- PASS: TestStringN (0.00 seconds)\n    === RUN TestStringLowerN\n    --- PASS: TestStringLowerN (0.00 seconds)\n    === RUN TestRandomIntn\n    --- PASS: TestRandomIntn (0.00 seconds)\n    === RUN TestServer\n    --- PASS: TestServer (0.00 seconds)\n    PASS\n    ok      github.com/dmuth/procedural-webserver   0.031s\n\n\n### TODO list for The Future\n- Optimizations under heavy load\n- Generate a random title for each page\n- Add support for making page links include a 404 code a certain percentage of the time\n- Add support for making page links ionclude a 3xx code a ceratin percentage of the time\n\n### Comments and complaints!\n\nSend them to me, Douglas Muth: http://www.dmuth.org/contact\n\nFiling a bug here is fine, too!\n\nEither way, I'd love to know if you're using this webserver, and find it helpful.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuth%2Fprocedural-webserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmuth%2Fprocedural-webserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuth%2Fprocedural-webserver/lists"}