{"id":21833158,"url":"https://github.com/rwstauner/ynetd","last_synced_at":"2025-04-14T07:38:02.063Z","repository":{"id":27377920,"uuid":"107923823","full_name":"rwstauner/ynetd","owner":"rwstauner","description":"micromanage your microservices with a super server written in go","archived":false,"fork":false,"pushed_at":"2022-05-31T21:55:58.000Z","size":159,"stargazers_count":82,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T18:17:54.241Z","etag":null,"topics":["go","golang"],"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/rwstauner.png","metadata":{"files":{"readme":"README.mkdn","changelog":"CHANGELOG.md","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":"2017-10-23T02:43:43.000Z","updated_at":"2025-01-02T06:00:21.000Z","dependencies_parsed_at":"2022-07-27T09:32:04.776Z","dependency_job_id":null,"html_url":"https://github.com/rwstauner/ynetd","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fynetd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fynetd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fynetd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fynetd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwstauner","download_url":"https://codeload.github.com/rwstauner/ynetd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248840658,"owners_count":21170032,"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":["go","golang"],"created_at":"2024-11-27T19:28:39.477Z","updated_at":"2025-04-14T07:38:02.021Z","avatar_url":"https://github.com/rwstauner.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/rwstauner/ynetd.svg?branch=master)](https://travis-ci.org/rwstauner/ynetd)\n\n![micromanager](/micromanager.png)\n\n# ynetd\n\nMicromanage your microservices with a tiny super server written in go.\n\n    ynetd -proxy \":8080 localhost:8081\" cmd arg...\n\n- Listen on the specified address for connections.\n- When one is received, launch the specified program (with arguments).\n- Wait for the specified port to become ready.\n- Forward this connection (and all future traffic) to the new service.\n\nIf you have a service that might not be used\nyou can make it available while only consuming a tiny amount of RAM\nwhen it isn't needed.\n\nThe impetus for this was a docker-compose project with a handful\nof micro services.  Each service consumes several hundred megabytes\nof RAM, while some of them might never be used during any given\n`docker-compose up` session.\n\nRather than fiddling with which services to launch or exclude and how to make\nthem available when needed, just put `ynetd` in front of them.\nRAM usage for each container is now only 500K but the services will vivify\nautomatically if a request to them is made.\n\n\n## Features\n\n- Lazily load a service and forward all connections.\n\n  Since it starts quickly, you don't need to configure clients to check and see\n  if the port is listening, just connect and it will hold the connection until\n  the service is ready.\n\n- Stop the service after a period of inactivity.\n\n  When the last client disconnects, wait the specified period of time, and shut\n  it down.  Reclaim those resources when you're done!\n\n- Watch for the service to exit and restart it next time it is needed.\n\n  This is additionally handy for services that crash,\n  whether they throw exceptions, or are sacrificed by the OOM killer.\n  No manual restarts (or inifinite loop wrappers) required.\n\n- Wait longer for a service to start.\n\n  Some services may open their port before really being ready to use\n  (especially if they have their own child services).\n  Configure an additional period to wait after starting the service before\n  forwarding any traffic.\n  Clients don't need to know they have to wait, they can connect instantly\n  and the traffic will forward when ready.\n\n- Forward multiple ports.\n\n  If a service listens on multiple ports,\n  it can listen to and forward all of them.\n\n- Forward port traffic to another host.\n\n  It can be run without a command specified and will simply forward the traffic.\n  This can be a simpler alternative to using `iptables` or `netsh`\n  since it requires no additional dependencies or special privileges and doesn't\n  involve permanent system configuration.\n\n\n## Installation\n\n### Homebrew\n\nInstall via [homebrew](https://brew.sh):\n\n    brew tap rwstauner/ynetd\n    brew install ynetd\n\n### Universal\n\nDownload the zip file for your OS from the [releases](https://github.com/rwstauner/ynetd/releases) page\nor use something like this:\n\n    YNETD_VERSION=v0.14\n    wget -qO /tmp/ynetd.zip https://github.com/rwstauner/ynetd/releases/download/$YNETD_VERSION/ynetd-linux-amd64.zip \\\n      \u0026\u0026 unzip -d /usr/local/bin/ /tmp/ynetd.zip \\\n      \u0026\u0026 rm -f /tmp/ynetd.zip\n\nTo verify the signature of the zip files:\n\n    YNETD_VERSION=v0.14\n    url=https://github.com/rwstauner/ynetd/releases/download/$YNETD_VERSION/ynetd-linux-amd64.zip \\\n      \u0026\u0026 wget -qO /tmp/ynetd.zip $url \\\n      \u0026\u0026 wget -qO /tmp/ynetd.zip.asc $url.asc \\\n      \u0026\u0026 gpg --no-tty --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 9791707D75D1474B6936CA216AD6ED6EA9371AED \\\n      \u0026\u0026 gpg --no-tty --batch --verify /tmp/ynetd.zip.asc /tmp/ynetd.zip \\\n      \u0026\u0026 unzip -d /usr/local/bin/ /tmp/ynetd.zip \\\n      \u0026\u0026 rm -f /tmp/ynetd.zip /tmp/ynetd.zip.asc\n\n## Configuration\n\nOne service can be configured on the command line:\n\n    -auto-start       # Start the command immediately\n    -proxy            # Address pairs to listen on/proxy to (\"from:port to:port from2 to2\")\n    -proxy-sep        # Alternate character to separate proxy addresses\n    -stop-after       # Duration after last connection to signal command to stop\n    -stop-signal      # Signal to send to command (default is TERM)\n    -timeout          # Duration to wait before aborting connection\n    -wait-after-start # Duration to wait after starting command before forwarding connections\n    args...           # Command to run\n\nAlternatively (or additionally) multiple services\ncan be configured by specifying the path to a YAML configuration file:\n\n    -config /path/to/ynetd.conf\n\nWhich should look something like:\n\n    ---\n    services:\n      -\n        auto_start: true\n        proxy:\n          \":5000\": \"localhost:5001\"\n          \"localhost:6543\": \"localhost:7654\"\n        command:\n          - run\n          - some\n          - service\n        stop_after: 10m\n        stop_signal: INT\n        timeout: 10s\n        wait_after_start: 2s\n\nEverything is optional (except for \"proxy\").\n\nWithout a command to run, ynetd can be used as a simple port forwarder:\n\n    ynetd -proxy \"localhost:5001 remote.host:8080\"\n\nAddresses can be specified as:\n\n- \"host:port\"\n\n- \":port\" (all addresses) (source)\n\n- \"interface:name:port\" (\"interface:eth0:5001\") to listen on\n(all addresses of) the named interface (source)\n\nThis can be useful if you don't know the ip address up front\nbut want to forward from public interface to loopback\nto avoid having to use additional port numbers:\n\n    -proxy \"interface:eth0:5000 localhost:5000\"\n\n- \"exec:/full/path/to/command\" (destination)\n\nUseful to get the destination address dynamically from a command.\nThe command will receive the following arguments:\n- local address (host:port)\n- remote address (host:port)\nThe command should print the destination \"host:port\" on stdout and return zero.\nIf the command exits non-zero the status and stderr of the command\nwill be printed to stdout and the connection will be dropped.\n\n    -proxy \"localhost:5000 exec:/usr/local/bin/current-tunnel-address\"\n\nNOTE: You must specify a full path (must start with a slash).\n\n\n## Why?\n\n- To reduce resource utilization for services until they are needed.\n- To regain resources when they are no longer needed.\n- To simplify container configuration.\n- To learn a little go.\n\n## Why the name?\n\nI wanted something like `xinetd` but something that would launch\nanother (long running) server and just forward connections.\n\n- \"y\" comes after \"x\"\n- Maybe `[tin]ynetd`\n- Stop asking \":why: are you eating all my RAM?\"\n- y not?\n\n## License\n\nCopyright © 2017 Randy Stauner.\nDistributed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwstauner%2Fynetd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwstauner%2Fynetd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwstauner%2Fynetd/lists"}