More utilities
======
Docker moved to https://github.com/v2fly/docker
Utilities to support Project V
License: MIT License
More utilities
======
Docker moved to https://github.com/v2fly/docker
latest docker build on docker hub is 4.20, which is 4 four month behind.
please update the build!
loving your woks, guys
是迁移去了v2fly/v2fly-core 么?
如果是的希望能在文档和readme里体现一下
根据 go 官方对 GOPATH 的定义:
The GOPATH environment variable lists places to look for Go code.
On Unix, the value is a colon-separated string.
On Windows, the value is a semicolon-separated string.
On Plan 9, the value is a list.
在 Linux 下,GOPATH 包含多个路径(使用冒号分割)时。在 genRegularTarget
函数中会导致拼接出错误的源路径,导致如下错误:
Building V2Ray (custom) for linux amd64
Failed to build V2Ray on amd64 for linux with error open /var/tmp/portage/net-proxy/v2ray-3.21/work/v2ray-3.21:/usr/lib/go-gentoo/src/v2ray.com/core/release/config/geoip.dat: no such file or directory
另: build/vbuild
报错时返回值仍然是 0 。
当我想使用自己的config.json时,我可以使用-v ${APPDATADIR}/v2ray/config:/etc/v2ray.
但当我想使用自定义的资源文件时,由于缺省的资源文件路径中还有v2ray执行文件,我不能使用-v ${APPDATADIR}/v2ray/asset:/usr/bin/v2ray, 会报错找不到可执行文件。
建议在dockerfile中作如下修改:
COPY --from=builder /usr/bin/v2ray/geoip.dat /newpath/to/asset/
COPY --from=builder /usr/bin/v2ray/geosite.dat /newpath/to/asset/
ENV V2RAY_LOCATION_ASSET /newpath/to/asset/
其实我一直认为v2ray-core把资源文件放在/usr/bin里不是太好, /usr/bin里一大堆可执行文件和软链接文件中放着一个v2ray文件夹总觉得有点奇怪。
v2ray.com/ext/tools/conf/serial: failed to parse json config > v2ray.com/ext/tools/conf: no inbound config specified
当使用 core.StartInstance 和 core.Dial 来调用 v2ray 时是可以不要 inbound 的,希望可以去掉这个报错
FROM ubuntu:latest as builder
RUN apt-get update \
&& apt-get install curl -y \
&& curl -fsSL https://install.direct/go.sh | bash
FROM scratch
LABEL maintainer "Darian Raymond <[email protected]>"
COPY --from=builder /usr/bin/v2ray/v2ray /usr/bin/v2ray/v2ctl /usr/bin/v2ray/geoip.dat /usr/bin/v2ray/geosite.dat /usr/bin/v2ray/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY config.json /etc/v2ray/config.json
ENV PATH /usr/bin/v2ray:$PATH
CMD ["v2ray", "-config=/etc/v2ray/config.json"]
这样就OK
非用alpine当底包不可的话
就直接
FROM alpine
FROM alpine:latest
似乎直接初始化不过
不知为何
似乎只是单纯的镜像有问题
重构建一边就成?
在特定的 JSON 文本环境,Ext 中 encoding/json
部分对转义字符处理实现有问题,会导致 go 的标准库 encoding/json
直接崩溃。特定环境是,当 JSON 文本的第 512 个字节刚好是 \
的时候,会造成崩溃。因为我刚好遇到了 JSON 文本刚好第 512 个字节开始是 path 部分,如:\/v2ray.com
v2ray -config test.json
V2Ray 3.14 (die Commanderin) Custom
An unified platform for anti-censorship.
panic: runtime error: slice bounds out of range
goroutine 1 [running]:
encoding/json.(*Decoder).refill(0xc4201d0000, 0x22, 0x1)
/usr/local/go/src/encoding/json/stream.go:160 +0x23f
encoding/json.(*Decoder).readValue(0xc4201d0000, 0x0, 0x0, 0xace560)
/usr/local/go/src/encoding/json/stream.go:134 +0x23d
encoding/json.(*Decoder).Decode(0xc4201d0000, 0xa1cae0, 0xc4201ce000, 0xd0, 0xa83840)
/usr/local/go/src/encoding/json/stream.go:63 +0x78
v2ray.com/ext/tools/conf/serial.LoadJSONConfig(0xb704c0, 0xc4200b0000, 0xc42019a6c0,0xc42006bee8, 0x410319)
/home/dawndiy/workspace/golang/src/v2ray.com/ext/tools/conf/serial/loader.go:18 +0xd1
v2ray.com/ext/tools/conf/command.init.0.func1(0xc4200b4000, 0x0, 0x0)
/home/dawndiy/workspace/golang/src/v2ray.com/ext/tools/conf/command/command.go:15 +0x4b
main.main()
src/v2ray.com/ext/tools/control/main/main.go:31 +0xeb
Main: failed to read config file: test.json > Main|Json: failed to execute v2ctl to convert config file. > exit status 2
崩溃的原因是 io.Reader.Read() 返回的结果长度大于传入 []byte 的长度。
io.Reader.Read() 的注释里有如下描述:
// Read reads up to len(p) bytes into p. It returns the number of bytes
// read (0 <= n <= len(p)) and any error encountered. Even if Read
// returns n < len(p), it may use all of p as scratch space during the call.
在 Go 的 encoding/json
标准库的 decoder 中先会用长度为 512 的 []byte 来调用 io.Reader.Read() (ext 的实现) ,当第 512 字节是转义符号的时候处理是没有追加到返回中,而是跳过了。这时候 io.Reader.Reader() 返回的 n 是 511。然后如果剩下的内容还很长,第二次继续读取的时候会以 1025 长度的输入来调用函数,然而 ext 中的实现,因为上一次是标记了转义(这里导致少返回一个字节),这次会多插入一个字节(这里导致多插入一个字节,并且由于 p := b[:0]
这里会导致 p
提前后移,后面的内容就都重复了)。
简单尝试了一下在 Reader 结构中加一个 buffer []byte
来存多余的部分,但由于现在的实现 p
有的时候会一次追加 2 个字节导致循环过程修改了本身内容,不太好做,可以讨论一下有什么好的办法。
上面我应该描述清楚了,简单写了个测试用例可以来测试: dawndiy@da0a47f#diff-7d2da6197eab2fafc43d39c5180a853c
Line 323 in eb8ac55
如题,这一段应该直接从指定的文件中读取数据。
Line 27 in d461791
设备为ARM64的,在Docker Hub库里面找到v2ray/official后直接pull镜像到本地设备,然后运行时提示
standard_init_linux.go:207: exec user process caused "exec format error"
不知是何原因,貌似是跨平台的问题好像。可否解决一下,谢谢大佬
chinaSitesDomains里面为什么包含了google-analytics.com,这个网站是不能正常访问的吧
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.