[NEW PORT]: net/v2ray: Platform for building proxies to bypass network restrictions

Project V is a set of network tools that help you to build your
own computer network. It secures your network connections and
thus protects your privacy.

WWW: https://www.v2ray.com

PR:		235418
Submitted by:	Yanhui Shen <shen.elf@gmail.com>
Reviewed by:	koobs, mat
Approved by:	koobs (mentor)
Differential Revision:	https://reviews.freebsd.org/D19066
This commit is contained in:
Fukang Chen 2019-05-08 03:23:29 +00:00
parent b24bed390d
commit 58319c2c00
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=500991
7 changed files with 113 additions and 2 deletions

2
GIDs
View File

@ -300,7 +300,7 @@ nzbhydra2:*:355:
# free: 357
# free: 358
# free: 359
# free: 360
v2ray:*:360:
httptunnel:*:361:
# free: 362
# free: 363

2
UIDs
View File

@ -305,7 +305,7 @@ nzbhydra2:*:355:355::0:0:NZBHydra 2 Daemon:/nonexistent:/usr/sbin/nologin
# free: 357
# free: 358
# free: 359
# free: 360
v2ray:*:360:360::0:0:V2Ray Daemon:/nonexistent:/usr/sbin/nologin
httptunnel:*:361:361::0:0:httptunnel Daemon:/nonexistent:/usr/sbin/nologin
# free: 362
# free: 363

View File

@ -1479,6 +1479,7 @@
SUBDIR += urlendec
SUBDIR += usbredir
SUBDIR += utftpd
SUBDIR += v2ray
SUBDIR += vblade
SUBDIR += vde
SUBDIR += vde2

53
net/v2ray/Makefile Normal file
View File

@ -0,0 +1,53 @@
# $FreeBSD$
PORTNAME= v2ray
PORTVERSION= 4.14.0
CATEGORIES= net
MASTER_SITES= https://github.com/v2ray/v2ray-core/releases/download/v${PORTVERSION}/
DISTNAME= src_all
DIST_SUBDIR= ${PORTNAME}-${PORTVERSION}
MAINTAINER= shen.elf@gmail.com
COMMENT= Platform for building proxies to bypass network restrictions
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/v2ray.com/core/LICENSE
USES= go zip
NO_WRKSUBDIR= yes
WRKSRC= ${WRKDIR}/src
GO_BUILDFLAGS+= --ldflags '-s -w'
USE_RC_SUBR= v2ray
USERS= v2ray
GROUPS= v2ray
PLIST_FILES= bin/v2ray \
bin/v2ctl \
"@sample ${ETCDIR}/config.json.sample" \
${ETCDIR}/vpoint_socks_vmess.json \
${ETCDIR}/vpoint_vmess_freedom.json \
${DATADIR}/geoip.dat \
${DATADIR}/geosite.dat
SUB_LIST= USER="${USERS}" \
GROUP="${GROUPS}"
do-build:
@cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} build ${GO_BUILDFLAGS} -o ${GO_WRKDIR_BIN}/v2ray v2ray.com/core/main && \
${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} build ${GO_BUILDFLAGS} -o ${GO_WRKDIR_BIN}/v2ctl v2ray.com/ext/tools/control/main
do-install:
${MKDIR} ${STAGEDIR}${ETCDIR}
${MKDIR} ${STAGEDIR}${DATADIR}
${INSTALL_PROGRAM} ${WRKDIR}/bin/v2ray ${STAGEDIR}${PREFIX}/bin/v2ray
${INSTALL_PROGRAM} ${WRKDIR}/bin/v2ctl ${STAGEDIR}${PREFIX}/bin/v2ctl
${INSTALL_DATA} ${WRKSRC}/v2ray.com/core/release/config/config.json ${STAGEDIR}${ETCDIR}/config.json.sample
${INSTALL_DATA} ${WRKSRC}/v2ray.com/core/release/config/vpoint_socks_vmess.json ${STAGEDIR}${ETCDIR}/vpoint_socks_vmess.json
${INSTALL_DATA} ${WRKSRC}/v2ray.com/core/release/config/vpoint_vmess_freedom.json ${STAGEDIR}${ETCDIR}/vpoint_vmess_freedom.json
${INSTALL_DATA} ${WRKSRC}/v2ray.com/core/release/config/geoip.dat ${STAGEDIR}${DATADIR}/geoip.dat
${INSTALL_DATA} ${WRKSRC}/v2ray.com/core/release/config/geosite.dat ${STAGEDIR}${DATADIR}/geosite.dat
.include <bsd.port.mk>

3
net/v2ray/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1549167902
SHA256 (v2ray-4.14.0/src_all.zip) = 842a8bf2a2f5787ca854b61697a444e86928650def5bae512b99c52e95230648
SIZE (v2ray-4.14.0/src_all.zip) = 31614054

49
net/v2ray/files/v2ray.in Normal file
View File

@ -0,0 +1,49 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: v2ray
# KEYWORD: shutdown
# Add these lines to /etc/rc.conf.local or /etc/rc.conf to enable `v2ray':
#
# v2ray_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable v2ray
# v2ray_config (path): Set to "%%PREFIX%%/etc/v2ray/config.json" by default
# Set it to the v2ray server config
# v2ray_logdir (path): Set to "/var/log/v2ray" by default.
# Set it to the directory of v2ray log files
# v2ray_env (str): Set to "" by default.
# Set it to the desired environment variables
. /etc/rc.subr
name="v2ray"
rcvar="${name}_enable"
: ${v2ray_enable="NO"}
: ${v2ray_config="%%PREFIX%%/etc/$name/config.json"}
: ${v2ray_logdir="/var/log/${name}"}
: ${v2ray_env=""}
: ${v2ray_user="%%USER%%"}
: ${v2ray_group="%%GROUP%%"}
asset_env="V2RAY_LOCATION_ASSET=%%PREFIX%%/share/$name"
pidfile="/var/run/$name.pid"
procname="%%PREFIX%%/bin/$name"
command="/usr/sbin/daemon"
command_args="-c -p ${pidfile} /usr/bin/env ${asset_env} ${v2ray_env} ${procname} -config ${v2ray_config}"
required_files="${v2ray_config}"
start_precmd="v2ray_startprecmd"
v2ray_startprecmd() {
touch "${pidfile}"
chown ${v2ray_user}:${v2ray_group} "${pidfile}"
mkdir -p "${v2ray_logdir}"
chown -R ${v2ray_user}:${v2ray_group} "${v2ray_logdir}"
}
load_rc_config "$name"
run_rc_command "$1"

5
net/v2ray/pkg-descr Normal file
View File

@ -0,0 +1,5 @@
Project V is a set of network tools that help you to build your
own computer network. It secures your network connections and
thus protects your privacy.
WWW: https://www.v2ray.com