Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V5: ping & links command #485

Closed
wants to merge 8 commits into from
Closed

Conversation

qjebbs
Copy link
Contributor

@qjebbs qjebbs commented Dec 3, 2020

This PR add 2 commands ping & links.

Examples:

    v2ray links vmess://... vmess://...   (1)
    v2ray links -t name -u url -o dir     (2)
    v2ray links -c path/to/json -o dir    (3)

(1) Convert links and save to current directory.
(2) Fetch and convert links from the subscription url.
(3) Fetch and convert links from multiple subscriptions.

Useful?

Together with commands from recent PRs, v2ray now can:

  1. fetch subscription with v2ray links -u <url>, save to: a.json, b.json...
  2. check nodes with v2ray ping a.json, v2ray ping b.json...
  3. add good nodes with v2ray api ado a.json
  4. remove bad nodes with v2ray api rmo b.json
  5. Repeat above steps with scheduled Tasks

I was hesitated to start this PR. If you have any concerns, like:

  • vmess:// links is not officially supported
  • Codes are copied from vmessping project, but you may still want to keep it as an independent project
  • Any other concerns

If so, feel free to close it, I am continue to keep them for my personal use.

### PS: Anyone knows why the test build are all failed??

@qjebbs qjebbs marked this pull request as draft December 3, 2020 08:39
@qjebbs qjebbs changed the title V5: ping & subscription command V5: ping & links command Dec 3, 2020
@qjebbs qjebbs marked this pull request as ready for review December 3, 2020 10:31
@Loyalsoldier
Copy link
Contributor

The v2ctl builds

CGO_ENABLED=0 go build -o v2ctl -trimpath -ldflags "-s -w -buildid=" -tags confonly ./infra/control/main

failed because there is a build tag confonly. And there is a line // +build !confonly in v2ray.go, so you can NOT init the v2ray instance in miniv2ray.

@qjebbs qjebbs marked this pull request as draft December 3, 2020 12:40
@kslr
Copy link
Contributor

kslr commented Dec 3, 2020

We are advancing v2fly/v2fly-github-io#26
Welcome to post your thoughts

@qjebbs
Copy link
Contributor Author

qjebbs commented Dec 4, 2020

The v2ctl builds

CGO_ENABLED=0 go build -o v2ctl -trimpath -ldflags "-s -w -buildid=" -tags confonly ./infra/control/main

failed because there is a build tag confonly. And there is a line // +build !confonly in v2ray.go, so you can NOT init the v2ray instance in miniv2ray.

Thanks again for your reply. Now that we have come to this part, shall we remove v2ctl now? #488

@qjebbs
Copy link
Contributor Author

qjebbs commented Dec 4, 2020

@kslr I feel it's pretty good.

Did you suggest that we should only support the official link format?

Regarding to my links command implementation, it's ugly though, Link is an interface:

type Link interface {
	Tag() string
	Detail() string
	ToOutbound() *conf.OutboundDetourConfig
}

Works for vmess:// and vless:// in the future (if it would be there)

Parsing procedure of vmess:// links, tries and fallback between different formats. We can add the official format then.

@kslr
Copy link
Contributor

kslr commented Dec 4, 2020

@kslr I feel it's pretty good.

Did you suggest that we should only support the official link format?

Regarding to my links command implementation, it's ugly though, Link is an interface:

type Link interface {
	Tag() string
	Detail() string
	ToOutbound() *conf.OutboundDetourConfig
}

Works for vmess:// and vless:// in the future (if it would be there)

Parsing procedure of vmess:// links, tries and fallback between different formats. We can add the official format then.

Yes, I personally don't like the format of NG(other etc)
We are still discussing standards, Are you interested in joining the Telegram group?

@qjebbs
Copy link
Contributor Author

qjebbs commented Dec 4, 2020

@kslr Of course. How?

@qjebbs qjebbs force-pushed the ping_subscription_command branch 4 times, most recently from 6cc702d to 45aff2e Compare December 14, 2020 09:10
@qjebbs
Copy link
Contributor Author

qjebbs commented Dec 16, 2020

这个PR目标是添加 linksping 命令,与官方链接格式有间接关联,但没有直接关联。因此:

  • 将链接解析器改为注册机制
  • 根据之前讨论,默认不启用第三方链接支持

这样,这个PR可以绕开对官方格式进展的依赖,可以考虑先提交。

目前状态下 linksping 命令是完成状态,只是没有注册任何链接解析器,因此不能工作。

用户可以用反裁剪的方式,开启第三方链接格式支持。

若是认为以下说法成立,请考虑合并此PR:

  • linksping 命令是有必要的
  • 链接解析器注册机制可以接受,后续在此基础上添加 vmess://,vless:// 等支持

若否,如一开始所说的,我留作个人用途。

@qjebbs qjebbs marked this pull request as ready for review December 16, 2020 05:22
@qjebbs qjebbs force-pushed the ping_subscription_command branch from 019bb09 to 4711338 Compare December 21, 2020 05:05
@qjebbs qjebbs force-pushed the ping_subscription_command branch from 4711338 to 5715cc5 Compare January 12, 2021 04:20
@qjebbs qjebbs closed this Feb 4, 2021
@Loyalsoldier
Copy link
Contributor

Why closed?

@qjebbs
Copy link
Contributor Author

qjebbs commented Feb 5, 2021

Why closed?

I realized that:

  • leastload takes most job of ping for me
  • links cmd to fetch subscription, it's kind of not the "core" stuff

@qjebbs qjebbs deleted the ping_subscription_command branch February 22, 2021 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants