{"id":19233764,"url":"https://github.com/ossrs/tc-ui","last_synced_at":"2025-08-12T02:33:22.961Z","repository":{"id":186246969,"uuid":"674881763","full_name":"ossrs/tc-ui","owner":"ossrs","description":"WebUI for tcconfig and tc on Linux server.","archived":false,"fork":false,"pushed_at":"2024-05-22T08:08:43.000Z","size":238,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-18T03:06:24.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ossrs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-05T03:57:18.000Z","updated_at":"2025-06-16T12:46:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"8b3c327f-8305-4fb7-915e-93e8dc697814","html_url":"https://github.com/ossrs/tc-ui","commit_stats":null,"previous_names":["ossrs/tc-ui"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ossrs/tc-ui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Ftc-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Ftc-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Ftc-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Ftc-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ossrs","download_url":"https://codeload.github.com/ossrs/tc-ui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Ftc-ui/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269988875,"owners_count":24508544,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-09T16:11:46.452Z","updated_at":"2025-08-12T02:33:22.908Z","avatar_url":"https://github.com/ossrs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tc-ui\n\nWebUI for [tcconfig](https://github.com/thombashi/tcconfig) which wraps\n[TC(Linux Traffic Control)](https://lartc.org/howto/index.html) on Linux servers.\n\n\u003cimg width=\"576\" alt=\"tcui\" src=\"https://github.com/ossrs/tc-ui/assets/2777660/91fb5051-6ace-4c3e-9364-1a2a526be62b\"\u003e\n\n## Usage\n\nEnsure there is `ifb.ko` on your server:\n\n```bash\nls /lib/modules/$(uname -r)/kernel/drivers/net/ifb.ko 2\u003e/dev/null \u0026\u0026 echo yes || echo no\n```\n\nRun TC WebUI by docker:\n\n```bash\ndocker run --network=host --privileged -it --restart always -d \\\n    --name tc -v /lib/modules:/lib/modules:ro ossrs/tc-ui:1\n```\n\n\u003e Note: Only support Linux server, because it requires kernel module ifb and host network mode.\n\n\u003e Note: Please use `registry.cn-hangzhou.aliyuncs.com/ossrs/tc-ui:1` in China.\n\nOpen [http://localhost:2023](http://localhost:2023) in browser.\n\n## Usage for Mac\n\nNote that Mac does not support host network, nor ifb, so can only be used for outgoing network:\n\n```bash\ndocker run --rm -it --privileged --name tc -p 2023:2023 ossrs/tc-ui:1\n```\n\nOpen [http://localhost:2023](http://localhost:2023) in browser.\n\n\u003e Note: Because no host network, you should run command or application in container, for example, ping after setup the delay of network.\n\n## Concepts of TC\n\nAbout the terminology of TC, see [Terminology](https://lartc.org/howto/lartc.qdisc.terminology.html).\n\n```text\n                Userspace programs\n                     ^\n                     |\n     +---------------+-----------------------------------------+\n     |               Y                                         |\n     |    -------\u003e IP Stack                                    |\n     |   |              |                                      |\n     |   |              Y                                      |\n     |   |              Y                                      |\n     |   ^              |                                      |\n     |   |  / ----------\u003e Forwarding -\u003e                        |\n     |   ^ /                           |                       |\n     |   |/                            Y                       |\n     |   |                             |                       |\n     |   ^                             Y          /-qdisc1-\\   |\n     |   |                            Egress     /--qdisc2--\\  |\n  ---\u003e-\u003eIngress                       Classifier ---qdisc3---- | -\u003e\n     |   Qdisc                                   \\__qdisc4__/  |\n     |                                            \\-qdiscN_/   |\n     |                                                         |\n     +----------------------------------------------------------+\n```\n\n\u003e Note: There is a note about this diagram in Chinese if you want, see [link](https://arthurchiao.art/blog/lartc-qdisc-zh/#4-%E6%9C%AF%E8%AF%AD).\n\nThe qdisc, handle and class is a hierarchy, but not the network path, see [Classful Queueing Disciplines](https://lartc.org/howto/lartc.qdisc.classful.html):\n\n```text\n          1:   root qdisc\n           |\n          1:1    child class\n        /  |  \\\n       /   |   \\\n      /    |    \\\n      /    |    \\\n   1:10  1:11  1:12   child classes\n    |      |     | \n    |     11:    |    leaf class\n    |            | \n    10:         12:   qdisc\n   /   \\       /   \\\n10:1  10:2   12:1  12:2   leaf classes\n```\n\nThe prio qdisc is a common used qdisc, see [The PRIO qdisc](https://lartc.org/howto/lartc.qdisc.classful.html):\n\n```text\n          1:   root qdisc\n         / | \\ \n       /   |   \\\n       /   |   \\\n     1:1  1:2  1:3    classes\n      |    |    |\n     10:  20:  30:    qdiscs    qdiscs\n     sfq  tbf  sfq\nband  0    1    2\n```\n\n[HTB](http://linux-ip.net/articles/Traffic-Control-HOWTO/classful-qdiscs.html) uses the concepts of tokens and buckets \nalong with the class-based system and filters to allow for complex and granular control over traffic.\n\nYou can also use BPF in tc, see [Understanding tc “direct action” mode for BPF](https://qmonnet.github.io/whirl-offload/2020/04/11/tc-bpf-direct-action/) \nor [tea](https://github.com/winlinvip/tea#links-tc).\n\n## Export and Load Docker Image\n\nIf want to export the docker image:\n\n```bash\ndocker pull ossrs/tc-ui:1\ndocker save ossrs/tc-ui:1 |gzip \u003e tc-ui.tar.gz\n```\n\nIf want to download the arm64 docker image:\n\n```bash\ndocker pull --platform linux/arm64 ossrs/tc-ui:1\ndocker save ossrs/tc-ui:1 |gzip \u003e tc-ui.tar.gz\n```\n\nLoad the docker image:\n\n```bash\ndocker load -i tc-ui.tar.gz\n```\n\n## HTTP OpenAPI\n\nThere is an HTTP OpenAPI, pass cmd in HTTP POST body, for example:\n\n```bash\ncurl http://localhost:2023/tc/api/v1/config/raw -X POST -d 'tcshow lo'\n```\n\nSet 10% loss of interface lo:\n\n```bash\ncurl http://localhost:2023/tc/api/v1/config/raw -X POST -d 'tcset lo --loss 10%'\n#{\"code\":0,\"data\":null}\n```\n\nGet settings of interface lo:\n\n```bash\ncurl http://localhost:2023/tc/api/v1/config/raw -X POST -d 'tcshow lo'\n#{\"code\":0,\"data\":{\"lo\":{\"incoming\":{},\"outgoing\":{}}}}\n```\n\nReset all settings of interface lo:\n\n```bash\ncurl http://localhost:2023/tc/api/v1/config/raw -X POST -d 'tcdel --all lo'\n#{\"code\":0,\"data\":null}\n```\n\nOnly allow `tcset`, `tcshow` and `tcdel`, or failed:\n\n```bash\ncurl http://localhost:2023/tc/api/v1/config/raw -X POST -d 'ls'\n#{\"code\":100,\"data\":\"invalid cmd ls\"}\n```\n\nFor TC command, see:\n\n* [Set traffic control (tcset command)](https://tcconfig.readthedocs.io/en/latest/pages/usage/tcset/index.html)\n* [Delete traffic control (tcdel command)](https://tcconfig.readthedocs.io/en/latest/pages/usage/tcdel/index.html)\n* [Display traffic control configurations (tcshow command)](https://tcconfig.readthedocs.io/en/latest/pages/usage/tcshow/index.html)\n\n## Development in macOS\n\nRun Go API server in Ubuntu20 server or docker:\n\n```bash\ndocker build -t test -f Dockerfile.dev .\ndocker run --privileged --rm -it -p 2023:2023 -v $(pwd):/g -w /g test go run .\n```\n\n\u003e Note: Note that macOS docker doesn't support ingress, which requires kernel module ifb.\n\n\u003e Note: Must run with `--privileged` or failed to run `tc` and `tcpdump` commands.\n\nBuild UI:\n\n```bash\n(cd ui \u0026\u0026 npm install \u0026\u0026 npm run build)\n# Or\n(cd ui \u0026\u0026 npm install \u0026\u0026 npm run start)\n```\n\nOpen http://localhost:3000/ in browser.\n\n## Tools\n\nPlease install required tools, for Ubuntu20:\n\n```bash\napt-get update -y\napt-get install -y curl tcpdump iputils-ping iproute2\ncurl -L https://golang.google.cn/dl/go1.16.12.linux-amd64.tar.gz |tar -xz -C /usr/local\nexport PATH=$PATH:/usr/local/go/bin\n```\n\nPlease install tc and tcpdump:\n\n```bash\nsudo apt-get install -y iproute2 tcpdump\n```\n\nYou can verify the installation by `tc qdisc help` and `tcpdump --version`.\n\nPlease install tcconfig:\n\n```bash\n# For Ubuntu20\nsudo apt-get install -y python3-pip\nsudo pip install tcconfig\n\n# For CentOS7\nsudo yum install -y python3-pip\nsudo pip3 install tcconfig\n```\n\nYou can verfiy the installation by `tcset --version`.\n\nPlease install Go 1.16+ by yourself and verfiy the installation by `go version`.\n\nThis is optional for docker.\n\n## Config\n\nConfig by environment variables, so create a `.env` file with:\n\n```bash\nAPI_HOST=ubuntu20\nAPI_LISTEN=2023\nUI_HOST=localhost\nUI_PORT=3001\nNODE_ENV=development\nIFACE_FILTER_IPV4=true\nIFACE_FILTER_IPV6=true\n```\n\nThis is optional.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossrs%2Ftc-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossrs%2Ftc-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossrs%2Ftc-ui/lists"}