Git Product home page Git Product logo

v2gen'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

v2gen's Issues

How to check what the errors are?

There info beside each node like "(2 errors)". I'm wondering what these are and how to check in more detail. Currently all my nodes have pings of 0.

Can't run the program

Describe the bug
Can't run the program

To Reproduce
Steps to reproduce the behavior:
Download the latest version release and run it

./v2gen_amd64_linux: line 1: syntax error near unexpected token `newline'
./v2gen_amd64_linux: line 1: `!<arch>'

Desktop (please complete the following information):

  • OS: Windows10 LTSC and Archlinux latest
  • Version 1.4.2

I found that the executable file size is only about 10kb, which is not normal for a golang application
The release and compiled versions of V1.4.2 also have problems
V1.4.1 looks normal?

Some further requirments.

Hi,

Thanks a lot for your reply. Now I want to have following feather with v2gen:

1- Setting the inbounds ports for specific protocols using as argument of v2gen.
So that it can be used in for-loop for setting multiple config files.

2- Only generate the inbounds and outbound parts of the config.

Could you please add these functions into v2gen?

输出端口更改无效

我设置了v2gen的v2gen.ini里的httpPort,但是我再次生成v2配置文件时,他的输出端口还是1080

能不能把所有的节点输出成outbounds.json

能不能把所有的节点输出成outbounds.json
节点名 用tag来标记,或者用1,2,3,4等数字也行。
这样订阅对于v2ray的意义可能更大。
因为v2ray-croe现在(v4.38.0+)是支持每隔一段时间测试节点并选择随机节点或HTTPS GET 请求完成时间最快的节点。

Runing `v2gen -u "https://api.xinjie.eu.org/link/89j4g4oET" -o "-"` leads to error

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:
run v2gen -u "https://api.xinjie.eu.org/link/89j4g4oET" -o "-"

Expected behavior
show list

Desktop (please complete the following information):

  • OS: centos

Additional context
`2020/08/17 11:32:59 v2ray.com/core/infra/conf: failed to parse to outbound detour config. > invalid character '<' looking for beginning of value
2020/08/17 11:32:59 v2ray.com/core/infra/conf: failed to parse to outbound detour config. > invalid character '<' looking for beginning of value
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x794d62]

goroutine 11 [running]:
v2ray.com/core.(*Instance).Start(0x0, 0x0, 0x0)
/home/runner/work/v2gen/v2gen/go/src/v2ray.com/core/v2ray.go:311 +0x42
iochen.com/v2gen/app/ping/vmessping.VmessPing(0xc00005c728, 0x3, 0xd06f21, 0x24, 0x19, 0x8, 0x0, 0x0, 0x0, 0x0)
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/app/ping/vmessping/vmessping.go:17 +0xe1
iochen.com/v2gen.Ping(0xc00005c728, 0x0, 0x0, 0x0)
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/ping.go:106 +0x139
iochen.com/v2gen.MakeNode(0x0, 0xc000437600, 0x17, 0xc000437560, 0x11, 0xb97920, 0xc0000364d8, 0xc00003a510, 0x24, 0x0, ...)
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/ping.go:87 +0x2f
created by iochen.com/v2gen.PingNodes.func1
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/ping.go:55 +0x152
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x794d62]

goroutine 12 [running]:
v2ray.com/core.(*Instance).Start(0x0, 0x0, 0x0)
/home/runner/work/v2gen/v2gen/go/src/v2ray.com/core/v2ray.go:311 +0x42
iochen.com/v2gen/app/ping/vmessping.VmessPing(0xc00005cf28, 0x3, 0xd06f21, 0x24, 0x19, 0x8, 0x0, 0x0, 0x0, 0x0)
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/app/ping/vmessping/vmessping.go:17 +0xe1
iochen.com/v2gen.Ping(0xc00005cf28, 0x0, 0x0, 0x0)
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/ping.go:106 +0x139
iochen.com/v2gen.MakeNode(0x1, 0xc000437680, 0x19, 0xc000437640, 0x11, 0xb97920, 0xc0000364f8, 0xc00003a540, 0x24, 0x0, ...)
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/ping.go:87 +0x2f
created by iochen.com/v2gen.PingNodes.func1
/home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/ping.go:55 +0x152
`

v2gen --init still will fail.

See the following:

$ ./v2gen --init
panic: open /etc/v2ray/v2gen.ini: no such file or directory

goroutine 1 [running]:
main.checkErr(...)
/home/werner/software/anti-gfw/socks5/v2ray/V2Gen.git/main.go:64
main.main()
/home/werner/software/anti-gfw/socks5/v2ray/V2Gen.git/main.go:45 +0x1ef

能保留多个 节点吗?

我这一堆的节点,好几分钟不损失测试完毕了,结果你就然我选一个??
有点不太行,

Can not run with alpine

root@hw:~/test/v2tproxy# ./v2gen -h
Usage of ./v2gen:
  -best
    	use best node judged by ping result
  -c string
    	v2gen config path (default "/etc/v2ray/v2gen.ini")
  -ct int
    	ping count for each node (default 3)
  -dest string
    	test destination url (vmess ping only) (default "https://cloudflare.com/cdn-cgi/trace")
  -eto int
    	timeout seconds for each request (default 8)
  -ic
    	use ICMP ping instead of vmess ping
  -init
    	initialize v2gen config
  -med
    	use median instead of ArithmeticMean
  -n int
    	node index (default -1)
  -np
    	do not ping
  -o string
    	output path (default "/etc/v2ray/config.json")
  -r	random node index
  -sort
    	sort ping results
  -t int
    	threads used when pinging (default 5)
  -tpl string
    	V2Ray tpl path
  -tto int
    	timeout seconds for each node (default 25)
  -u string
    	subscription URL
  -v	show version
  -vmess string
    	vmess link(s)
root@hw:~/test/v2tproxy# cat Dockerfile
FROM alpine
RUN apk update && apk add bash wget curl
COPY v2gen /bin

ENTRYPOINT ["v2gen","-h"]
root@hw:~/test/v2tproxy# docker build .
Sending build context to Docker daemon  6.264MB
Step 1/4 : FROM alpine
 ---> f70734b6a266
Step 2/4 : RUN apk update && apk add bash wget curl
 ---> Using cache
 ---> e1f545f422cb
Step 3/4 : COPY v2gen /bin
 ---> Using cache
 ---> c07a856be4c9
Step 4/4 : ENTRYPOINT ["v2gen","-h"]
 ---> Running in 38f2f9464628
Removing intermediate container 38f2f9464628
 ---> d06c197a5cf2
Successfully built d06c197a5cf2
root@hw:~/test/v2tproxy# docker run -it --rm d06c19
root@hw:~/test/v2tproxy# 

No matter what command it is, it cannot be executed.

parse error on this field: "host":"/ws"

Hi,

See the following example:
Taken from here: https://free-ss.site/
vmess://eyJwcyI6IltmcmVlLXNzLnNpdGVdd3d3Lmtlcm5lbHMuYmlkIiwiYWRkIjoid3d3Lmtlcm5lbHMuYmlkIiwicG9ydCI6IjQ0MyIsImlkIjoiNGY4MjJiNzEtMTBhMS05ZTM3LTg0YzgtNzgwY2MzY2ZkMmM2IiwiYWlkIjoiMCIsIm5ldCI6IndzIiwidHlwZSI6Im5vbmUiLCJob3N0IjoiL3dzIiwidGxzIjoidGxzIn0=

For the field: "host":"/ws", v2gen will give the following:

```

"wsSettings": {
"path": "{{path}}",
"headers": {
"Host": "/ws"
}
}


But, in fact, the above setting will not work, the correct should be the following:
   "wsSettings": {
      "path": "/ws"
    }

You can see it from here: 
https://free-ss.site/v/443.json

Regards

./v2gen_amd64_linux --init or ./v2gen_amd64_linux -init 报错

root@VM-0-7-debian:~/v2ray# ./v2gen_amd64_linux --init
v2gen v2.0.1, V2Ray 4.31.0 (go1.15.8 1cores linux/amd64)
panic: open /etc/v2ray/v2gen.ini: no such file or directory

goroutine 1 [running]:
main.main()
	/home/runner/work/v2gen/v2gen/cmd/v2gen/main.go:163 +0x20a5
root@VM-0-7-debian:~/v2ray# ./v2gen_amd64_linux -init
v2gen v2.0.1, V2Ray 4.31.0 (go1.15.8 1cores linux/amd64)
panic: open /etc/v2ray/v2gen.ini: no such file or directory

goroutine 1 [running]:
main.main()
	/home/runner/work/v2gen/v2gen/cmd/v2gen/main.go:163 +0x20a5

I have found the v2rayN config's differences among different versions.

Hi,

See here:

https://github.com/2dust/v2rayN/blob/master/v2rayN/v2rayN/Handler/ConfigHandler.cs

The following section in this file:


///
/// 配置文件版本升级
///

///
///
public static int UpgradeServerVersion(ref VmessItem vmessItem)
{
try
{
if (vmessItem == null
|| vmessItem.configVersion == 2)
{
return 0;
}
if (vmessItem.configType == (int)EConfigType.Vmess)
{
string path = "";
string host = "";
string[] arrParameter;
switch (vmessItem.network)
{
case "kcp":
break;
case "ws":
//*ws(path+host),它们中间分号(;)隔开
arrParameter = vmessItem.requestHost.Replace(" ", "").Split(';');
if (arrParameter.Length > 0)
{
path = arrParameter[0];
}
if (arrParameter.Length > 1)
{
path = arrParameter[0];
host = arrParameter[1];
}
vmessItem.path = path;
vmessItem.requestHost = host;
break;
case "h2":
//*h2 path
arrParameter = vmessItem.requestHost.Replace(" ", "").Split(';');
if (arrParameter.Length > 0)
{
path = arrParameter[0];
}
if (arrParameter.Length > 1)
{
path = arrParameter[0];
host = arrParameter[1];
}
vmessItem.path = path;
vmessItem.requestHost = host;
break;
default:
break;
}
}
vmessItem.configVersion = 2;
}
catch
{
}
return 0;
}

This explained the previously discussed issues:

#6

How to use -tpl?

I custom a tpl from https://toutyrater.github.io/app/tproxy.html , but it not work.

root@hw:~/test/v2tproxy# ./test.sh
panic: unexpected end of JSON input

goroutine 1 [running]:
main.main()
        /home/runner/work/v2gen/v2gen/go/src/iochen.com/v2gen/cmd/main.go:42 +0x2ff
root@hw:~/test/v2tproxy#

how to custom a tpl?

my custom tpl:

{
  "log": {
    "loglevel": "{{loglevel}}"
  },
  "inbounds": [
    {
      "tag":"transparent",
      "port": 12345,
      "protocol": "dokodemo-door",
      "settings": {
        "network": "tcp,udp",
        "followRedirect": true
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "streamSettings": {
        "sockopt": {
          "tproxy": "tproxy"
        }
      }
    },
    {
      "port": {{socksPort}},
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
		"udp": {{udp}}
      }
    },
    {
      "port": {{httpPort}},
      "protocol": "http",
      "settings": {
		"udp": {{udp}}
      }
    }
  ],
  "outbounds": [ 
	{
	"tag": "proxy",
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "{{address}}",
          "port": {{serverPort}},
          "users": [
            {
              "id": "{{uuid}}",
              "alterId": {{aid}},
              "security": "{{security}}"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "{{network}}",
      "security": "{{streamSecurity}}",
      "tlsSettings": {{tls}},
      "kcpSettings": {{kcp}},
      "wsSettings": {{ws}},
      "httpSettings": {{http}},
      "quicSettings": {{quic}},
	  "sockopt": {
        "mark": 255
      },
	  "mux": {
  		"enabled": {{mux}},
      	"concurrency": {{concurrency}}
      }
    }
  	},
    {
      "tag": "direct",
	  "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIP"
      },
      "streamSettings": {
        "sockopt": {
          "mark": 255
        }
      }
    },
    {
      "tag": "dns-out",
      "protocol": "dns",
      "streamSettings": {
        "sockopt": {
          "mark": 255
        }
      }  
    }
],
  "dns": {
    "servers": [
      "8.8.8.8",
      "1.1.1.1",
      "114.114.114.114",
      {
        "address": "223.5.5.5",
        "port": 53,
        "domains": [
          "geosite:cn",
          "ntp.org",
          "localhost"
        ]
      }
    ]
  },
	"routing": {
		"domainStrategy": "IPOnDemand",
		"rules": [
		  {
			"type": "field",
			"inboundTag": [
			  "transparent"
			],
			"port": 53,
			"network": "udp",
			"outboundTag": "dns-out" 
		  },    
		  {
			"type": "field",
			"inboundTag": [
			  "transparent"
			],
			"port": 123,
			"network": "udp",
			"outboundTag": "direct" 
		  },    
		  {
			"type": "field", 
			"ip": [
			  "223.5.5.5",
			  "114.114.114.114"
			],
			"outboundTag": "direct"
		  },
		  {
			"type": "field",
			"ip": [
			  "8.8.8.8",
			  "1.1.1.1"
			],
			"outboundTag": "proxy"
		  },
		  {
			"type": "field",
			"protocol":["bittorrent"], 
			"outboundTag": "direct"
		  },
		  {
			"type": "field", 
			"ip": [
			  "geoip:private",
			  "geoip:cn"
			],
			"outboundTag": "direct"
		  },
		  {
			"type": "field", 
			"domain": [
			  "geosite:cn"
			],
			"outboundTag": "direct"
		  }
		]
    }
}

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.