mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-10-18 22:54:32 +08:00
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
/*Package main 读取配置文件,将其内容转化为 proxy.Client和 proxy.Server,然后进行代理转发.
|
||
|
||
命令行参数请使用 --help查看详情。
|
||
|
||
如果一个命令行参数无法在标准配置中进行配置,那么它就属于高级选项,或者不推荐的选项,或者正在开发中的功能.
|
||
|
||
Config Format 配置格式
|
||
|
||
一共有三种配置格式,极简模式,标准模式,兼容模式。
|
||
|
||
“极简模式”(即 verysimple mode),入口和出口仅有一个,而且都是使用共享链接的url格式来配置.
|
||
|
||
标准模式使用toml格式。
|
||
|
||
兼容模式可以兼容v2ray现有json格式。(暂未实现)。
|
||
|
||
极简模式的理念是,配置文件的字符尽量少,尽量短小精悍;
|
||
|
||
还有个命令行模式,就是直接把极简模式的url 放到命令行参数中,比如:
|
||
|
||
verysimple -L socks5://sfdfsaf -D direct://
|
||
|
||
|
||
Structure 本项目结构
|
||
|
||
main -> proxy.Standard(配置文件) -> netLayer-> tlsLayer -> httpLayer -> ws -> proxy.
|
||
|
||
main中,读取配置文件,生成 Dail、Listen 和 RoutePolicy 对象后,开始监听;
|
||
|
||
用 netLayer操纵路由,用tlsLayer嗅探tls,用httpLayer操纵回落,可选经过ws, 然后都搞好后,传到proxy,然后就开始转发
|
||
|
||
Other - 其他
|
||
|
||
另外,本作暂时不考虑引入外界log包。依赖越少越好。
|
||
|
||
*/
|
||
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"runtime"
|
||
|
||
"github.com/hahahrfool/v2ray_simple/netLayer"
|
||
)
|
||
|
||
var Version string //版本号由 Makefile 里的 BUILD_VERSION 指定
|
||
|
||
func printVersion() {
|
||
const desc = "verysimple, a very simple implementation of V2Ray with some innovation"
|
||
|
||
fmt.Printf("===============================\nverysimple %v (%v), %v %v %v\n", Version, desc, runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||
fmt.Println("Support tls and websocket for all protocols.")
|
||
if netLayer.HasEmbedGeoip() {
|
||
fmt.Println("Contains embeded Geoip file")
|
||
}
|
||
|
||
}
|