Code Monkey home page Code Monkey logo

x's People

Contributors

cgroschupp avatar char8x avatar dependabot[bot] avatar ginuerzh avatar honwen avatar vanym avatar wankkoree avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

x's Issues

SIGSEGV when no dialer specified

App crashes when connector specified and dialer not specified

$ ./gost-linux-amd64-3.0.0-rc.0 -C configv3nodialer.yaml 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbc32db]

goroutine 1 [running]:
github.com/go-gost/x/config/parsing.ParseHop(0xc00053ea20)
        /home/gerry/code/go-gost/x/config/parsing/chain.go:89 +0x3db
github.com/go-gost/x/config/parsing.ParseChain(0xc000635a10)
        /home/gerry/code/go-gost/x/config/parsing/chain.go:46 +0x2a5
main.buildService(0xc000570420)
        /home/gerry/code/go-gost/gost/cmd/gost/config.go:109 +0xd6d
main.main()
        /home/gerry/code/go-gost/gost/cmd/gost/main.go:143 +0x7eb
To Reproduce

configv3nodialer.yaml

services:
- name: socks-0
  addr: ":1080"
  handler:
    type: socks5
    chain: chain-0
chains:
- name: chain-0
  hops:
  - name: hop-0
    nodes:
    - name: node-0
      addr: 127.0.0.1:9050
      connector:
        type: socks5
#      dialer:
#        type: tcp

Run
./gost-linux-amd64-3.0.0-rc.0 -C configv3nodialer.yaml

Expected behavior

Do not crash in this case. I guess app should just use tcp dialer as default

Make context ClientID and ClientIDFromContext public.

I plan to utilize the x package as a library. The implementation is expected to provide the result of a Dial, specifically a net.Conn, based on the authorized ClientID. The new Dialer, however, will not perform an actual dial; instead, it will retrieve the net.Conn from a map[ClientID]net.Conn

For this purpose, I would need the ClientIDFromContext method and the ClientID type to be public. However, they are currently internal, as seen here: https://github.com/go-gost/x/blob/master/internal/ctx/value.go.

Could you provide public access to the ClientID value from the context?

Decrypt failed with shadowsocks protocol.

Hi, I'm using shadowsocks protcol in chain, when the both client side and server side is gost, got this error:

{"handler":"ss","kind":"handler","level":"error","listener":"tcp","local":"[2001:db8::x]:100x,"msg":"chacha20poly1305: message authentication failed","remote":"[2001:db8::x]:100x","service":"shadowsocks""}

After that, I tried to replace the server side from gost to shadowsocks-rust, got this error on shadowsocks-rust:

WARN  tcp handshake failed. peer: [2001:db8::x]:100x, decrypt length failed

And when I replace both the client side and server side from gost to shadowsocks-rust, everythings fine. So I'm wondering is that something wrong with gost's shadowsocks support? Any help will be appreciated.

引用不再维护的库

项目中引用的 github.com/shadowsocks/shadowsocks-go 库已经不再维护了,是不是需要替换掉。这个旧的库支持的加密算法量有点少。

SIGSEGV when specify "direct" dialer with non "direct" connector

App crashes when using node with "direct" dialer and non "direct" connector

$ ./gost-linux-amd64-3.0.0-rc.0 -C configv3directcrash.yaml 
{"handler":"socks5","kind":"service","level":"info","listener":"tcp","msg":"listening on [::]:1080/tcp","service":"socks-0","time":"…"}
{"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"127.0.0.1:1080","msg":"127.0.0.1:39054 <> 127.0.0.1:1080","remote":"127.0.0.1:39054","service":"socks-0","time":"…"}
{"duration":3982118,"handler":"socks5","kind":"handler","level":"info","listener":"tcp","local":"127.0.0.1:1080","msg":"127.0.0.1:39054 >< 127.0.0.1:1080","remote":"127.0.0.1:39054","service":"socks-0","time":"…"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xc53973]

goroutine 81 [running]:
github.com/go-gost/x/connector/socks/v5.(*socks5Connector).Handshake(0xc00007ccc0, {0x1471650?, 0xc00007ccc0?}, {0x0, 0x0})
        /home/gerry/code/go-gost/x/connector/socks/v5/connector.go:71 +0x73
github.com/go-gost/core/chain.(*Transport).Handshake(0xc00007cd20, {0x1478bf8, 0xc0006e4750}, {0x0?, 0x0?})
        /home/gerry/code/go-gost/core/chain/transport.go:103 +0x19d
github.com/go-gost/x/chain.(*route).connect(0xc0006e5260, {0x1478bf8, 0xc0006e4750}, {0x1488cb0, 0xc0008263e8})
        /home/gerry/code/go-gost/x/chain/route.go:158 +0x2db
github.com/go-gost/x/chain.(*route).Dial(0xc0006e5260, {0x1478bf8, 0xc0006e4750}, {0x1297d30, 0x3}, {0xc000412170, 0xa}, {0xc0000d0180, 0x3, 0x3})
        /home/gerry/code/go-gost/x/chain/route.go:61 +0x15e
github.com/go-gost/core/chain.(*Router).dial(0xc0005f6100, {0x1478bf8, 0xc0006e4750}, {0x1297d30, 0x3}, {0xc000412170, 0xa})
        /home/gerry/code/go-gost/core/chain/router.go:181 +0x58f
github.com/go-gost/core/chain.(*Router).Dial(0xc000412170?, {0x1478bf8, 0xc0006e4750}, {0x1297d30, 0x3}, {0xc000412170, 0xa})
        /home/gerry/code/go-gost/core/chain/router.go:119 +0xee
github.com/go-gost/x/handler/socks/v5.(*socks5Handler).handleConnect(0xc0003a3f40, {0x1478bf8, 0xc0006e4750}, {0x1481a40, 0xc000378040}, {0x1297d30, 0x3}, {0xc000412170, 0xa}, {0x1488cb0, ...})
        /home/gerry/code/go-gost/x/handler/socks/v5/connect.go:34 +0x3fe
github.com/go-gost/x/handler/socks/v5.(*socks5Handler).Handle(0xc0003a3f40, {0x1478bf8, 0xc0006e4750}, {0x1481a40, 0xc000378040}, {0xc00062c010?, 0xc0006e97b8?, 0xbc1893?})
        /home/gerry/code/go-gost/x/handler/socks/v5/handler.go:102 +0x7b3
github.com/go-gost/x/service.(*defaultService).Serve.func1()
        /home/gerry/code/go-gost/x/service/service.go:186 +0x534
created by github.com/go-gost/x/service.(*defaultService).Serve
        /home/gerry/code/go-gost/x/service/service.go:162 +0x530
To Reproduce

configv3directcrash.yaml

services:
- name: socks-0
  addr: ":1080"
  handler:
    type: socks5
    chain: chain-0
chains:
- name: chain-0
  hops:
  - name: hop-0
    nodes:
    - name: node-0
      addr: 127.0.0.1:9050
      connector:
        type: socks5
      dialer:
        type: direct

Run gost
./gost-linux-amd64-3.0.0-rc.0 -C configv3directcrash.yaml
Make request
curl --socks5-hostname "127.0.0.1:1080" -v "https://ifconfig.me"

Expected behavior

Node should return error, but do not crash app

Thoughts about options to solve
  1. Check connection for nil in every connector and return error in this case
  2. Make special check for direct connector (add something like "nil connection allowed" interface) and return error if not
  3. "Direct" dialer will return non nil, but dummy connection which will return error on any function call and empty addrs
P.S.

Buy the way, name "direct" for dialer that do nothing is confusing (my first thought was that is same as "tcp"). May be consider renaming or alias it to "none"
Also I think "direct" connector should check that connection passed to it is nil or dummy and return error if not or may be just close whatever is passed

Socks5 client provides userpass auth method even when no auth configured

Socks5 connector always provides userpass auth method
This is not expected behavior and cause problems with some socks5 servers
Dante socks5 server select userpass over no auth and gost provide empty userpass

To Reproduce

Run dante server in docker
docker run -d -p 127.0.0.1:1080:1080 wernight/dante
Configure gost
configv3dante.yaml

services:
- name: socks-0
  addr: ":1082"
  handler:
    type: socks5
    chain: chain-0
chains:
- name: chain-0
  hops:
  - name: hop-0
    nodes:
    - name: node-0
      addr: 127.0.0.1:1080
      connector:
        type: socks5
      dialer:
        type: tcp

Run gost
./gost-linux-amd64-3.0.0-rc.0 -C configv3dante.yaml
Try request to dante directly
curl --socks5-hostname "127.0.0.1:1080" -v "https://ifconfig.me"
Try request to gost
curl --socks5-hostname "127.0.0.1:1082" -v "https://ifconfig.me"
You will see auth failure in gost output

You can use wireshark to see problem in authentication detailly

Expected behavior

Do not add userpass client auth method if auth not configured

保存配置文件路径调整

在docker中如果使用相对路径会保存到/bin/文件夹,导致持久化失效,虽然可以挂载文件但并不优雅。
这里感觉新增路径参数或保存到读取的配置文件的路径为保存路径比较好

func saveConfig(ctx *gin.Context) {

Obfs support

我记得Obfs4和Obfs-simple的支持在v2还有的啊?是因为什么原因移除了吗?

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.