diff --git a/GIDs b/GIDs index 5277190cc87d..9c466ba30768 100644 --- a/GIDs +++ b/GIDs @@ -300,7 +300,7 @@ nzbhydra2:*:355: # free: 357 # free: 358 # free: 359 -# free: 360 +v2ray:*:360: httptunnel:*:361: # free: 362 # free: 363 diff --git a/UIDs b/UIDs index e1bfad3d5bed..718a8e2500d2 100644 --- a/UIDs +++ b/UIDs @@ -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 diff --git a/net/Makefile b/net/Makefile index 47b8bb70a95a..ef8458e65358 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1479,6 +1479,7 @@ SUBDIR += urlendec SUBDIR += usbredir SUBDIR += utftpd + SUBDIR += v2ray SUBDIR += vblade SUBDIR += vde SUBDIR += vde2 diff --git a/net/v2ray/Makefile b/net/v2ray/Makefile new file mode 100644 index 000000000000..694e2be5c0aa --- /dev/null +++ b/net/v2ray/Makefile @@ -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> diff --git a/net/v2ray/distinfo b/net/v2ray/distinfo new file mode 100644 index 000000000000..c3c38b8ce0f0 --- /dev/null +++ b/net/v2ray/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1549167902 +SHA256 (v2ray-4.14.0/src_all.zip) = 842a8bf2a2f5787ca854b61697a444e86928650def5bae512b99c52e95230648 +SIZE (v2ray-4.14.0/src_all.zip) = 31614054 diff --git a/net/v2ray/files/v2ray.in b/net/v2ray/files/v2ray.in new file mode 100644 index 000000000000..2f9fae1a5717 --- /dev/null +++ b/net/v2ray/files/v2ray.in @@ -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" diff --git a/net/v2ray/pkg-descr b/net/v2ray/pkg-descr new file mode 100644 index 000000000000..9842de9669c6 --- /dev/null +++ b/net/v2ray/pkg-descr @@ -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