Coder Social home page Coder Social logo

mzz2017 / gg Goto Github PK

View Code? Open in Web Editor NEW
1.1K 8.0 105.0 341 KB

一个支持节点与订阅链接的 Linux 命令行代理工具 | A command-line tool for one-click proxy in your research and development without installing v2ray or anything else (only for linux)

License: GNU Affero General Public License v3.0

Go 97.44% Shell 2.56%
go-graft proxychains v2ray proxy graftcp

gg's Introduction

mzz2017's github stats

gg's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gg's Issues

unable to set CAP_SETFCAP effective capability: Operation not permitted

我在尝试不带root权限在zsh中从go.sh安装gg,遇到了这个报错。

应该是来自安装脚本的这一行

setcap cap_net_raw,cap_sys_ptrace+ep "${bin_dir}/gg" && cap_set=1

但是我没能查找到无需sudo权限运行这一行的方法。直接注释掉这一行是可行的吗?我对setcap不是很熟悉,不是很明白会对安装产生的影响

gg docker pull

gg config -w node=socks://192.168.1.33:7890
gg config
sudo -E gg -vv docker pull gcr.io/google-containers/busybox:latest


# 报错日志如下


Error response from daemon: Get "https://gcr.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
TRAC[0016] PtraceGetRegs: no such process               
TRAC[0016] child 229620 exited                          
TRAC[0016] child 229619 exited                          
TRAC[0016] child 229618 exited                          
TRAC[0016] child 229617 exited                          
TRAC[0016] child 229616 exited                          
TRAC[0016] child 229615 exited                          
TRAC[0016] child 229612 exited

可否自定义配置节点测速地址?

经过测试有很多节点是正常的,但是测速结果是-1ms。目前还不清楚具体原因,我用了1个v2订阅,全部节点测速正常,但是后面我尝试用了3个clash订阅,所有节点都是-1ms,但是实际上clash订阅里的节点都是正常的。在gg终端也是实际可用的,只是测速异常

感觉下面几个测速地址比较好用,想自定义配置一下
image



clash订阅我多次测速查看了所有节点都是-1ms (v2订阅的节点测速是正常的), 但是在window多次测速中, 只有2个是挂掉的。在gg终端也是实际可用的,只是测速异常
image

[BUG] It may encounter DNS pollution when using local DNS services

当用户使用本地 DNS 服务 如 systemd-resolved 时,他们会遇到 DNS 污染。
When someone uses local DNS services like systemd-resolved, they may encounter DNS pollution.

在详细的日志中可以看到 skip loopback: 127.0.0.53:53 的输出。
In verbose mode, it outputs: skip loopback: 127.0.0.53:53

arm64 error

9% [Working]panic: interface conversion: *shadowsocksr.SSTCPConn is not net.PacketConn: missing method ReadFrom

goroutine 287 [running]:
github.com/mzz2017/gg/proxy.(*Proxy).GetOrBuildUDPConn(0x40001b7500, {0x8bea40, 0x400028cff0}, {0x7a4bce, 0xa}, {0x400011e500, 0x2a, 0x40})
	github.com/mzz2017/gg/proxy/udp.go:181 +0x4fc
github.com/mzz2017/gg/proxy.(*Proxy).handleUDP(0x40001b7500, {0x8bea40?, 0x400028cff0}, {0x400011e500, 0x2a, 0x40})
	github.com/mzz2017/gg/proxy/udp.go:79 +0x2b4
github.com/mzz2017/gg/proxy.(*Proxy).ListenUDP.func1()
	github.com/mzz2017/gg/proxy/proxy.go:148 +0x48
created by github.com/mzz2017/gg/proxy.(*Proxy).ListenUDP
	github.com/mzz2017/gg/proxy/proxy.go:147 +0x288

debian11命令冲突

debian11会出现这个报错
git: 'gui' is not a git command.

手动把/usr/local/bin/gg重命名为手动把/usr/local/bin/ggg 再通过ggg来运行就没问题

'gg config -w subscription=' would fail to add subscription in zsh on arch linux host

I'm using zsh in my terminal.

$ gg --version
gg version 0.2.1

gg is fine, but when I add my subscription as document says:

$ gg config -w subscription='My link'

would result this error

zsh: no matches found: 'My link'

However, this problem seems fine with bash, I can add My link to gg in bash without any problem.
I'm not sure if this error is repeatable 'cause for now I'm just having one arch laptop. Could you kindly check it?
Thanks a lot.

在docker内运行有一处警告

在node:latest容器镜像内运行

报如下警告错误

$ gg curl ipinfo.io
time="2023-04-25T03:32:26Z" level=warning msg="error when get ptrace scope: open /proc/sys/kernel/yama/ptrace_scope: no such file or directory"

这个有影响吗?

可以在docker的centos中使用吗?

我尝试在linux的docker中使用,docker容器的系统是centos,当我使用您的go.sh,用命令./go.sh,出现如下错误
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

problem in installing (or using)

hi, I am so sorry to disturb your recent works. I find this command-line proxy tool recently, and I try to install this tool today. However, it doesn't work. can you give me some advices about how to solve this problem or what mistakes I have made?
(I can find the $PATH for gg, and its $PATH is also in my setting. and the mirror doesn't work, so I copied the gg.sh into local file)
截屏2023-11-21 13 16 45

Failed to Redirect UDP Connection

UDP conns can't be redirected to my socks5 node, listened by trojan-go v0.10.6.
gg says the server doesn't support it.

I tried a transproxy and confirmed that there is no problem with the UDP support of my trojan-go node.

As for gg, It runs in this way:

❯ gg -vv curl ip.sb
TRAC[0000] Version: 0.2.3                               
TRAC[0000] OS/Arch: linux/amd64                         
TRAC[0000] Using config file: /home/user1/.ggconfig.toml 
TRAC[0000] Config:
no_udp=false
test_node_before_use=true
subscription.link=
subscription.select=first
subscription.cache_last_node=true
node=socks5://localhost:7891
cache.subscription.last_node= 
INFO[0000] Your proxy server does not support UDP, so we will not redirect UDP traffic. 
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 4                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] network: unknown: family: 1, type: 526337    
TRAC[0000] new socket (): pid: 9521, fd 3               
TRAC[0000] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9521, fd: 3 
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] network: unknown: family: 1, type: 526337    
TRAC[0000] new socket (): pid: 9521, fd 3               
TRAC[0000] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9521, fd: 3 
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] new socket (udp): pid: 9521, fd 3            
TRAC[0000] close: pid: 9521, fd 3                       
TRAC[0000] network: unknown: family: 1, type: 526337    
TRAC[0000] new socket (): pid: 9522, fd 7               
TRAC[0000] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 7 
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] network: unknown: family: 1, type: 526337    
TRAC[0000] new socket (): pid: 9522, fd 7               
TRAC[0000] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 7 
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] network: unknown: family: 1, type: 526337    
TRAC[0000] new socket (): pid: 9522, fd 7               
TRAC[0000] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 7 
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] close: pid: 9522, fd 7                       
TRAC[0000] new socket (udp): pid: 9522, fd 7            
TRAC[0000] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 7 
TRAC[0000] syscall.SYS_CONNECT                          
TRAC[0000] handleINet4 (udp): origin: 1.0.0.1:53, after: 127.0.0.1:22545 
TRAC[0000] received udp: 127.0.0.1:40836, tgt: 1.0.0.1:53 
TRAC[0000] hijackDNS: lookup: ip.sb. to 198.18.0.1      
TRAC[0000] received udp: 127.0.0.1:40836, tgt: 1.0.0.1:53 
TRAC[0000] hijackDNS: lookup: ip.sb. to 198.18.0.1      
TRAC[0005] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 7 
TRAC[0005] syscall.SYS_SENDTO                           
TRAC[0005] received udp: 127.0.0.1:40836, tgt: 1.0.0.1:53 
TRAC[0005] hijackDNS: lookup: ip.sb. to 198.18.0.1      
TRAC[0010] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 7 
TRAC[0010] syscall.SYS_SENDTO                           
TRAC[0010] received udp: 127.0.0.1:40836, tgt: 1.0.0.1:53 
TRAC[0010] hijackDNS: lookup: ip.sb. to 198.18.0.1      
TRAC[0015] close: pid: 9522, fd 7                       
TRAC[0015] syscall.SYS_CONNECT, syscall.SYS_SENDTO: pid: 9522, fd: 6 
TRAC[0015] socketInfo of socket cannot found: pid: 9522, fd: 6 
TRAC[0015] child 9522 exited                            
TRAC[0015] close: pid: 9521, fd 6                       
TRAC[0015] close: pid: 9521, fd 5                       
curl: (6) Could not resolve host: ip.sb
TRAC[0015] close: pid: 9521, fd 3                       
TRAC[0015] close: pid: 9521, fd 4                       
TRAC[0015] child 9521 exited 

Is there anything wrong?
How to fix this?
Thanks a lot.

go 1.19 下编译产物无法运行

运行 archlinuxcn 上打包的 gg 提示如下内容且无法运行:

panic: Something in this program imports go4.org/unsafe/assume-no-moving-gc to declare that it assumes a non-moving garbage collector, but your version of go4.org/unsafe/assume-no-moving-gc hasn't been updated to assert that it's safe against the go1.19 runtime. If you want to risk it, run with environment variable ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19 set. Notably, if go1.19 adds a moving garbage collector, this program is unsafe to use.

goroutine 1 [running]:
go4.org/unsafe/assume-no-moving-gc.init.0()
        go4.org/unsafe/[email protected]/untested.go:25 +0x1f4

按提示添加 ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19 到环境变量仍可正常使用。

手动构建 main 分支报错相同,发行版为 Manjaro Linux 的 unstable 频道。

请问已经支持使用https节点了吗? 我直接使用https报错

root@debian11:# gg --node https://http用户:http密码@测试网址.com:10844 -vv scp -i /SCPkey -rp -P 60040 /root root@测试网址.com:/root/123123_test2233
TRAC[0000] Version: v0.2.3
TRAC[0000] OS/Arch: linux/amd64
TRAC[0000] Using config file: /root/.ggconfig.toml
TRAC[0000] Config:
test_node_before_use=true
node=https://http用户:http密码@测试网址.com:10844
subscription.link=
subscription.select=first
subscription.cache_last_node=true
cache.subscription.last_node=
no_udp=
FATA[0000] GetDialer:unable to connect to the proxy node: connectivity test failed: Get "https://fonts.gstatic.com/generate_204": tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config
root@debian11:
# ^C
root@debian11:
#

经过测试,直接使用http正常,用https节点的话如上报错.
https节点是xray开的,http+tls 1.3
image
试着换成最小tls版本1.1也还是不行.

Add Bypass feature

Hi
I'm using your lovely tool for crawling. But I need to have ability to bypass some specific destinations from being proxied.
Can you please consider this feature in your upcoming updates?
Thank you

tips: solve error `Segmentation fault (core dumped)`

A probable cause for the Segmentation fault (core dumped) error is that the UPX-compressed binary failed to self-unpacked and run on the current OS. This case has been caught on the Rocky Linux 9.1 OS.
(However, I can not reproduce this problem inside the docker image rockylinux:9.1)

People who ran into the same condition may try downloading the binary of UPX on the GitHub releases page, then issue the command upx -d ./gg to revert the compression.

Here is an example:

[root@xxx git]# ./test-bin
Segmentation fault (core dumped)
[root@xxx git]# upx -d ./test-bin
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2023
UPX 4.0.2       Markus Oberhumer, Laszlo Molnar & John Reiser   Jan 30th 2023

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
[WARNING] bad b_info at 0x55c58c

[WARNING] ... recovery at 0x55c588

  14471678 <-   5621256   38.84%   linux/amd64   test-bin

Unpacked 1 file.
[root@xxx git]# ll
total 14136
drwxr-xr-x. 13 root root     4096 Feb  7 16:08 gg
-rwxr-xr-x.  1 root root 14467072 Feb  7 16:14 test-bin
[root@xxx git]# ./test-bin --help
go-graft is a portable tool to redirect the traffic of a given
program to your modern proxy without installing any other programs.

Usage:
  gg [flags] [command [argument ...]]
  gg [command]

Available Commands:
  completion  generate the autocompletion script for the specified shell
  config      Get and set persistent global options
  help        Help about any command

Flags:
  -h, --help                  help for gg
  -n, --node string           node share-link of your modern proxy
      --noudp                 do not redirect UDP traffic, even though the proxy server supports
      --select                manually select the node to connect from the subscription
  -s, --subscription string   subscription-link of your modern proxy
      --testnode string       test the connectivity before connecting to the node (default "true")
  -v, --verbose count         verbose (-v, or -vv)
      --version               version for gg

Use "gg [command] --help" for more information about a command.

question: x86 32-bit support?

Hey. Is 32-bit support planned?

Currently, I get this output (see below), when building. Looks like it's due to missing 32-bit syscall implemetation.

# GOARCH=386 go build
# github.com/mzz2017/gg/tracer
tracer/stop_handler.go:31:10: undefined: inst
tracer/stop_handler.go:33:15: undefined: syscall.SYS_SOCKET
tracer/stop_handler.go:40:16: undefined: returnValueInt
tracer/stop_handler.go:73:19: undefined: returnValueInt
tracer/stop_handler.go:93:10: undefined: arguments
tracer/stop_handler.go:94:9: undefined: inst
tracer/stop_handler.go:102:15: undefined: syscall.SYS_SOCKET
tracer/stop_handler.go:104:31: undefined: inst
tracer/stop_handler.go:105:15: undefined: syscall.SYS_CONNECT
tracer/stop_handler.go:105:36: undefined: syscall.SYS_SENDTO
tracer/stop_handler.go:105:36: too many errors

订阅配置不成功

图片
请问,我配置订阅链接之后还需要额外的操作吗,这个报错好像是没有读到我的节点信息导致连接不上的意思吗,另外哪个链接才是应该选择的。事实上我试了几个都不行。。。
图片

[BUG] gg config -w 缺少语法检查

复现方法:

执行 gg config -w test_node_before_use==true 后,再使用 gg 命令即会报错,且无法通过 gg config -w 命令写入正常配置,必须手动修改 ~/.ggconfig.toml 配置文件才可恢复正常。

gg bash报错

FATA[0003] tracer.New:fork/exec /bin/bash: operation not permitted
image

关于端口代理

你好,我想请问一下如果我服务器上部署了一个开源项目,里面有个配置项,例如设置代理服务器 proxy_url = “http:127.0.0.1:1234”,gg这个程序是否可以设置一个本地的端口代理例如刚才提到的地址,然后我的项目访问这个地址就相当于经过代理了,谢谢你

git fatal: early EOF

gg git clone [email protected]:xxxxxxxx.git
Cloning into 'xxxxxxxx'...
remote: Enumerating objects: 1465, done.
remote: Counting objects: 100% (589/589), done.
remote: Compressing objects: 100% (269/269), done.
ssh_dispatch_run_fatal: Connection to 127.0.0.2 port 40931: message authentication code incorrect
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

gg是否支持go-gost

https://github.com/go-gost/gost

比如客户端为

services:
- name: client
  addr: ":1080"
  handler:
    type: socks5
    chain: chain-0
  listener:
    type: tcp
chains:
- name: chain-0
  hops:
  - name: hop-0
    nodes:
    - name: node-0
      addr: gg.org:443
      connector:
        type: socks5
        auth:
          username: gg
          password: gg@Gost
      dialer:
        type: mwss
        metadata:
          host: "gg.org" 
          path: "/ws" 
          header: {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.