{"id":13813634,"url":"https://github.com/mzz2017/gg","last_synced_at":"2025-05-15T14:07:42.882Z","repository":{"id":44197703,"uuid":"434620830","full_name":"mzz2017/gg","owner":"mzz2017","description":"一个支持节点与订阅链接的 Linux 命令行代理工具 | A command-line tool for one-click proxy in your research and development without installing v2ray or anything else (only for linux)","archived":false,"fork":false,"pushed_at":"2024-08-31T06:42:42.000Z","size":256,"stargazers_count":1702,"open_issues_count":36,"forks_count":132,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-07T17:06:01.302Z","etag":null,"topics":["go-graft","graftcp","proxy","proxychains","v2ray"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mzz2017.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":"2021-12-03T14:16:10.000Z","updated_at":"2025-04-07T14:40:08.000Z","dependencies_parsed_at":"2024-10-09T13:40:47.498Z","dependency_job_id":null,"html_url":"https://github.com/mzz2017/gg","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzz2017%2Fgg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzz2017%2Fgg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzz2017%2Fgg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzz2017%2Fgg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mzz2017","download_url":"https://codeload.github.com/mzz2017/gg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355335,"owners_count":22057354,"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-graft","graftcp","proxy","proxychains","v2ray"],"created_at":"2024-08-04T04:01:23.910Z","updated_at":"2025-05-15T14:07:37.868Z","avatar_url":"https://github.com/mzz2017.png","language":"Go","readme":"# gg (go-graft)\n\n[README](README.md) | [中文文档](README_zh.md)\n\n## What is gg?\n\ngg is a command-line tool for one-click proxy in your research and development.\n\nYou can just add `gg` before another command to redirect its traffic to your proxy without installing v2ray or anything else. Usage example: `gg python -m pip install torch`.\n\nIt was inspired by [graftcp](https://github.com/hmgle/graftcp), is a pure golang implementation with more useful\nfeatures.\n\n**Why did I create go-graft?**\n\nI am so tired of the poor network condition in my research and development. But I do not want to install v2ray in the\nworking servers because it is too heavy.\n\nThus, I need a light and portable command-line tool to help me download and install dependencies and software on various\nservers.\n\n**Advantages**\n\nCompared to proxychains or graftcp, we have the following advantages:\n\n1. Use it independently without any other proxy utils.\n2. UDP support.\n3. Support golang programs.\n   See [applications built by Go can not be hook by proxychains-ng](https://github.com/rofl0r/proxychains-ng/issues/199)\n   .\n\n## Installation\n\n1. Run this command to download the latest release of go-graft:\n\n    ```bash\n    sudo sh -c \"$(curl -L https://github.com/mzz2017/gg/raw/main/release/go.sh)\"\n    ```\n\n   \u003e Without `sudo`, gg will be installed to the user directory.\n   \u003e\n   \u003e If the command gg `fails` after installation, check your `$PATH`.\n   \u003e\n   \u003e You can also create a symbolic link to /usr/bin or any other directory in your path.\n   \u003e\n   \u003e For example:\n   \u003e\n   \u003e ```bash\n   \u003e sudo ln -s /usr/local/bin/gg /usr/bin/gg\n   \u003e ```\n2. Test the installation.\n   ```bash\n   $ gg --version\n   gg version 0.1.1\n   ```\n\n## Usage\n\n**Examples:**\n\nConfigure the subscription:\n\n```bash\ngg config -w subscription='https://example.com/path/to/sub'\n```\n\nTest with cloning linux repo:\n\n```bash\ngg git clone --depth=1 https://github.com/torvalds/linux.git\n```\n\nOutput:\n\n\u003e ```\n\u003e Cloning into 'linux'...\n\u003e ...\n\u003e Receiving objects: 100% (78822/78822), 212.19 MiB | 7.04 MiB/s, done.\n\u003e Resolving deltas: 100% (7155/7155), done.\n\u003e ```\n\nOr just redirect the traffic of whole shell session to your proxy:\n\n```bash\ngg bash\n\ngit clone --depth=1 https://github.com/torvalds/linux.git\ncurl ipv4.appspot.com\n```\n\n### Temporarily use\n\n**Use share-link**\n\n```bash\n# if no configuration was written before, a share-link will be required to input.\ngg wget -O frp.tar.gz https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_amd64.tar.gz\n```\n\n\u003e ```\n\u003e Enter the share-link of your proxy: ********\n\u003e ...\n\u003e Saving to: ‘frp.tar.gz’\n\u003e frp.tar.gz 100%[=====================================================\u003e] 8.44M 12.2MB/s in 0.7s    \n\u003e 2021-12-06 09:21:08 (12.2 MB/s) - ‘frp.tar.gz’ saved [8848900/8848900]\n\u003e ```\n\nOr use `--node`:\n\n```bash\ngg --node ss://YWVzLTEyOC1nY206MQ@example.com:17247 speedtest\n```\n\n\u003e ```\n\u003e Retrieving speedtest.net configuration...\n\u003e Testing from Microsoft (13.xx.xx.xx)...\n\u003e ...\n\u003e Hosted by xxx: 55.518 ms\n\u003e Testing download speed................................................................................\n\u003e Download: 104.83 Mbit/s\n\u003e Testing upload speed......................................................................................................\n\u003e Upload: 96.35 Mbit/s\n\u003e ```\n\n**Use subscription**\n\nBy default, gg will automatically select the first available node from the subscription:\n\n```bash\ngg --subscription https://example.com/path/to/sub docker pull caddy\n```\n\n\u003e ```\n\u003e Using default tag: latest\n\u003e latest: Pulling from library/caddy\n\u003e 97518928ae5f: Pull complete\n\u003e 23ccae726125: Pull complete\n\u003e 3de6a61c89ac: Pull complete\n\u003e 39ed957bdc00: Pull complete\n\u003e 0ae44c2d42dd: Pull complete\n\u003e Digest: sha256:46f11f4601ecb4c5a37d6014ad51f5cbfeb92b70f5c9ec6c2ac39c4c1a325588\n\u003e Status: Downloaded newer image for caddy:latest\n\u003e docker.io/library/caddy:latest\n\u003e ```\n\nSelect the node manually:\n\n```bash\ngg --subscription https://example.com/path/to/sub --select curl ipv4.appspot.com\n```\n\n\u003e ```\n\u003e WARN[0000] Test nodes...\n\u003e Use the arrow keys to navigate: ↓ ↑ → ←  and / toggles search\n\u003e Select Node\n\u003e   🛪 [200Mbps] LoadBalance (323 ms)\n\u003e     [200Mbps] LoadBalance Trojan (448 ms)\n\u003e     [30M] CN2-US Cera (560 ms)\n\u003e     [1Gbps] 4837-US (781 ms)\n\u003e     [10Gbps] CN2-DE (811 ms)\n\u003e     [300Mbps] Macau (1023 ms)\n\u003e     [300Mbps] IPv6 LoadBalance (-1 ms)\n\u003e ↓   [1Gbps] RackNerd (-1 ms)\n\u003e\n\u003e --------- Detail ----------\n\u003e Name:               [200Mbps] LoadBalance\n\u003e Protocol:           shadowsocks\n\u003e Support UDP:        true\n\u003e Latency:            323 ms\n\u003e\n\u003e ```\n\n### Long-term use\n\nWrite a config variable with `-w`:\n\nSet subscription:\n\n```bash\ngg config -w subscription=https://example.com/path/to/sub\ngg curl ipv4.appspot.com\n```\n\n\u003e ```\n\u003e 13.141.150.163\n\u003e ```\n\nSet node:\n\n```bash\ngg config -w node=vmess://MY_VMESS_SERVER_SHARE_LINK\ngg curl ipv4.appspot.com\n```\n\n\u003e ```\n\u003e 53.141.112.10\n\u003e ```\n\nList config variables:\n\n```bash\ngg config\n```\n\n\u003e ```\n\u003e node=\n\u003e subscription.link=https://example.com/path/to/sub\n\u003e subscription.select=first\n\u003e subscription.cache_last_node=true\n\u003e cache.subscription.last_node=trojan-go://MY_TROJAN_GO_SERVER_SHARE_LINK\n\u003e no_udp=false\n\u003e test_node_before_use=true\n\u003e ```\n\nUnset or reset specific config variable:\n\n```bash\ngg config -u node\n```\n\n\u003e ```\n\u003e node=\n\u003e ```\n\nRead specific config variable:\n\n```bash\ngg config node\n```\n\n\u003e ```\n\u003e vmess://MY_VMESS_SERVER_SHARE_LINK\n\u003e ```\n\n## Q\u0026A\n\n1. Q: When I use `sudo gg xxx`, it remains to ask me for share-link even though config has been set. How to solve it?\n\n   A: Use `sudo -E gg xxx` to solve it.\n2. Q: Can I use it on my IPv6-only machine?\n\n   A: Of course, as long as your proxy server has an IPv6 entry.\n3. Q: When I use `gg sudo xxx`, I get `sudo: effective uid is not 0, ...`, how can I fix it?\n   \n   A: You should run `sudo gg xxx` instead, because `setuid` and `ptrace` can not work together. See [stackoverflow](https://stackoverflow.com/questions/34279612/cannot-strace-sudo-reports-that-effective-uid-is-nonzero).\n4. Q: When I use `oh-my-zsh`, it reports `git: 'gui' is not a git command. See 'git --help'.`, ho can I fix it?\n   \n   A: It is a problem of `oh-my-zsh`, it added an alias from gg to `git gui`. Append following content to `~/.zshrc`:\n   ```bash\n   unalias gg\n   ```\n\n## Shell autocompletion\n\nIf you want to complete other commands while using gg, please follow the method below:\n\n### bash\n\nAdd this line to `~/.bashrc`:\n```shell\ncomplete -F _command gg\n```\n\n### zsh\n\nAdd this line to `~/.zshrc`:\n\n```shell\ncompdef _precommand gg\n```\n\nIf you get an error like `complete:13: command not found: compdef`, add following content in the beginning of the\n`.zshrc` file.\n\n```shell\nautoload -Uz compinit\ncompinit\n```\n\n### fish\n\nWrite following content in `~/.config/fish/completions/gg.fish`:\n\n```shell\n# fish completion for gg\n\nfunction __fish_gg_print_remaining_args\n    set -l tokens (commandline -opc) (commandline -ct)\n    set -e tokens[1]\n    if test -n \"$argv\"\n        and not string match -qr '^-' $argv[1]\n        string join0 -- $argv\n        return 0\n    else\n        return 1\n    end\nend\n\nfunction __fish_complete_gg_subcommand\n    set -l args (__fish_gg_print_remaining_args | string split0)\n    __fish_complete_subcommand --commandline $args\nend\n\n# Complete the command we are executed under gg\ncomplete -c gg -x -a \"(__fish_complete_gg_subcommand)\"\n```\n\n## Support List\n\n### OS/Arch\n\n- [x] Linux/amd64\n- [x] Linux/arm\n- [x] Linux/arm64\n- [ ] Linux/386\n\n### Protocol\n\n- [x] HTTP(S)\n- [x] Socks\n  - [x] Socks4\n  - [x] Socks4a\n  - [x] Socks5\n- [x] VMess(AEAD, alterID=0) / VLESS\n  - [x] TCP\n  - [x] WS\n  - [x] TLS\n  - [x] GRPC\n- [x] Shadowsocks\n  - [x] AEAD Ciphers\n  - [x] simple-obfs (not tested)\n  - [x] Stream Ciphers\n  - [ ] v2ray-plugin\n- [x] ShadowsocksR\n- [x] Trojan\n  - [x] Trojan-gfw\n  - [x] Trojan-go\n\n### Subscription\n\n- [x] Base64 (v2rayN, etc.)\n- [x] Clash\n- [x] SIP008\n- [ ] Surge\n- [ ] Quantumult\n- [ ] Quantumult X\n\n","funding_links":[],"categories":["Utilities","Go","\u003ca name=\"networking\"\u003e\u003c/a\u003eNetworking"],"sub_categories":["Network Utilities"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmzz2017%2Fgg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmzz2017%2Fgg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmzz2017%2Fgg/lists"}