{"id":13459319,"url":"https://github.com/inlets/mixctl","last_synced_at":"2025-04-04T14:10:06.426Z","repository":{"id":58878961,"uuid":"534329385","full_name":"inlets/mixctl","owner":"inlets","description":"A tiny TCP load balancer 🍸","archived":false,"fork":false,"pushed_at":"2024-08-05T10:19:01.000Z","size":124,"stargazers_count":465,"open_issues_count":1,"forks_count":24,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T13:10:15.422Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inlets.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-08T17:49:47.000Z","updated_at":"2025-03-15T23:21:31.000Z","dependencies_parsed_at":"2023-01-22T03:03:27.297Z","dependency_job_id":"c692c99c-11a9-4489-bfbc-e878c6125ac8","html_url":"https://github.com/inlets/mixctl","commit_stats":{"total_commits":44,"total_committers":2,"mean_commits":22.0,"dds":"0.34090909090909094","last_synced_commit":"95b509cc4d8773414426ca8b85b2c1f445671815"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlets%2Fmixctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlets%2Fmixctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlets%2Fmixctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inlets%2Fmixctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inlets","download_url":"https://codeload.github.com/inlets/mixctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190255,"owners_count":20898702,"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-07-31T09:01:15.790Z","updated_at":"2025-04-04T14:10:06.404Z","avatar_url":"https://github.com/inlets.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"## mixctl 🍸 - a tiny TCP load balancer\n\n[![Github All Releases](https://img.shields.io/github/downloads/inlets/mixctl/total.svg)]()\n\nmixctl by [inlets](https://docs.inlets.dev) is a tiny TCP load balancer written in Go. It was created to help [inlets users](https://docs.inlets.dev) to expose multiple services hosted on different servers over a single TCP tunnel.\n\n## What's it for?\n\nmixctl can be used to replace HAProxy, Traefik and/or Nginx Streams in certain scenarios. It could also be used as a lightweight load-balancer for K3s servers.\n\nThis is a lightweight, multi-arch, multi-OS, uncomplicated way to reverse proxy different TCP connections and/or load balance them.\n\n## Usage:\n\n1) Write a `rules.yaml` file such as: [rules.example.yaml](rules.example.yaml):\n\n```yaml\nversion: 0.1\n\nrules:\n- name: rpi-k3s\n  from: 127.0.0.1:6443\n  to:\n    - 192.168.1.19:6443\n    - 192.168.1.21:6443\n    - 192.168.1.20:6443\n\n- name: rpi-ssh\n  from: 127.0.0.1:22222\n  to:\n    - 192.168.1.19:22\n    - 192.168.1.21:22\n    - 192.168.1.20:22\n```\n\n2) Run the tool: `mixctl -f ./rules.yaml`\n\n3) Test out the proxy by calling your local endpoint such as `curl -k https://127.0.0.1:6443` and you should get a response back from each of the upstream endpoints.\n\n4) Now, if you're an inlets user, run `inlets-pro tcp client --ports 6443 --ports 22222 --upstream 127.0.0.1`, this exposes the ports that mixctl is listening to the tunnel server.\n\n4) Connect to ports 6443 or 22222 on your inlets Pro tunnel server to access any of the servers in the \"to\" array. The connections will be load balanced (with a random spread) if there are multiple hosts in the `to` field.\n\nTo make the upstream address listen on all interfaces, use `0.0.0.0` instead of `127.0.0.1` in the `from` field.\n\nThe port for the from and to addresses do not need to match.\n\nSee also:\n* `-t` - specify the dial timeout for an upstream host in the \"to\" field of the config file.\n* `-v` - verbose logging - set to false to turn off logs of connections established and closed.\n\n## Container image\n\n* [ghcr.io/inlets/mixctl:latest](https://ghcr.io/inlets/mixctl)\n\n```bash\ndocker run -ti ghcr.io/inlets/mixctl:latest\n```\n\nMake sure you mount in a config file, or create a new image with the config file added, along with exposing any ports you want to access from the Load Balancer:\n\n```\ndocker run -v `pwd`/configs:/configs \\\n  -p 6443:6443 \\\n  -p 22222:22222 \\\n   -ti ghcr.io/inlets/mixctl:latest -f /configs/rules.yaml\n```\n\nOr\n\n```Dockerfile\nFROM ghcr.io/inlets/mixctl:latest\nCOPY configs configs\n\nENTRYPOINT [\"/mixctl\", \"-f\", \"/configs/rules.yaml\"]\n```\n\n## License\n\nThis software is licensed MIT.\n\n## See also\n\n### inlets-connect\n\n[inlets-connect](https://github.com/alexellis/inlets-connect) is an equally tiny HTTP CONNECT proxy, designed to help users proxy HTTP and HTTPS endpoints over a single inlets tunnel.\n\n### \"cloud-provision\" library\n\nThe [cloud-provision](https://github.com/inlets/cloud-provision) library is used by [inletsctl](https://github.com/inlets/inletsctl) to create HTTP and TCP tunnel servers (VMs) with inlets pre-installed.\n\nYou can think of it like a low-level Terraform, which supports various popular clouds and VPS providers. Specify the plan, name, and user-data to configure the node with your desired software.\n\n### IPVS as an alternative to mixctl\n\nIP Virtual Server (IPVS)? [IPVS](https://debugged.it/blog/ipvs-the-linux-load-balancer/) is going to be more performant because it's part of the Linux kernel-space, instead of user-space (where normal programs like mixctl run). However IPVS requires a Linux host, additional Kernel modules to be loaded, and special Linux Kernel privileges, which you may be remiss to grant if using Docker or Kubernetes.\n\nInstead, mixctl is a lightweight, multi-arch, multi-OS, uncomplicated way to reverse proxy different TCP connections and/or load balance them.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finlets%2Fmixctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finlets%2Fmixctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finlets%2Fmixctl/lists"}