浏览代码

xray-core: replace the existing with upstreamed version

Signed-off-by: CN_SZTL <[email protected]>
CN_SZTL 4 年之前
父节点
当前提交
81579ea5db
共有 3 个文件被更改,包括 145 次插入143 次删除
  1. 1 1
      luci-app-ssr-plus/Makefile
  2. 144 0
      xray-core/Makefile
  3. 0 142
      xray/Makefile

+ 1 - 1
luci-app-ssr-plus/Makefile

@@ -52,7 +52,7 @@ LUCI_DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsm
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:simple-obfs \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
-	+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray \
+	+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \

+ 144 - 0
xray-core/Makefile

@@ -0,0 +1,144 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=xray-core
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/XTLS/xray-core/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=25f6c9edec0ac1f98328943cd2bb760ac7b69107582f9d27e43559da39dc01ed
+
+PKG_MAINTAINER:=Tianling Shen <[email protected]>
+PKG_LICENSE:=MPL-2.0
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_CONFIG_DEPENDS:= \
+	CONFIG_XRAY_CORE_PROVIDE_V2RAY_CORE \
+	CONFIG_XRAY_CORE_COMPRESS_GOPROXY \
+	CONFIG_XRAY_CORE_COMPRESS_UPX \
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Xray-core-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=golang/host
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+GO_PKG:=github.com/xtls/xray-core
+GO_PKG_BUILD_PKG:=github.com/xtls/xray-core/main
+GO_PKG_LDFLAGS:=-s -w
+GO_PKG_LDFLAGS_X:= \
+	$(GO_PKG)/core.version=$(PKG_VERSION) \
+	$(GO_PKG)/core.codename=OpenWrt
+
+include $(INCLUDE_DIR)/package.mk
+include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
+
+define Package/xray/template
+  TITLE:=A platform for building proxies to bypass network restrictions
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=https://xtls.github.io
+endef
+
+define Package/xray-core
+  $(call Package/xray/template)
+  DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
+  PROVIDES:=v2ray-core
+endef
+
+define Package/xray-geodata
+  $(call Package/xray/template)
+  TITLE+= (geodata files)
+  DEPENDS:=xray-core
+endef
+
+define Package/xray/description
+  Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
+  It secures your network connections and thus protects your privacy.
+endef
+
+define Package/xray-core/description
+  $(call Package/xray/description)
+endef
+
+define Package/xray-geodata/description
+  $(call Package/xray/description)
+
+  This includes GEO datas used for xray-core.
+endef
+
+define Package/xray-core/config
+menu "Xray-core Configuration"
+	depends on PACKAGE_xray-core
+
+config XRAY_CORE_PROVIDE_V2RAY_CORE
+	bool "Provide V2Ray binary using XRay"
+	default y
+
+config XRAY_CORE_COMPRESS_GOPROXY
+	bool "Compiling with GOPROXY proxy"
+	default n
+
+config XRAY_CORE_COMPRESS_UPX
+	bool "Compress executable files with UPX"
+	default y
+endmenu
+endef
+
+GEOIP_VER:=202101280019
+GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
+
+define Download/geoip
+  URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
+  URL_FILE:=geoip.dat
+  FILE:=$(GEOIP_FILE)
+  HASH:=69bb1f820f416e4591a7b76bfabf9fde9cce6550cddcc1a99b2ccafeb2a8ebd3
+endef
+
+GEOSITE_VER:=20210130061540
+GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
+
+define Download/geosite
+  URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
+  URL_FILE:=dlc.dat
+  FILE:=$(GEOSITE_FILE)
+  HASH:=bc9748c95b0545376356174b005fccfbc21d647df46293d5197853ee06a9c0a2
+endef
+
+ifneq ($(CONFIG_XRAY_CORE_COMPRESS_GOPROXY),)
+	export GO111MODULE=on
+	export GOPROXY=https://goproxy.io
+endif
+
+define Build/Prepare
+	$(call Build/Prepare/Default)
+ifneq ($(CONFIG_PACKAGE_xray-geodata),)
+	$(call Download,geoip)
+	$(call Download,geosite)
+endif
+endef
+
+define Build/Compile
+	$(call GoPackage/Build/Compile)
+ifneq ($(CONFIG_XRAY_CORE_COMPRESS_UPX),)
+	$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/main
+endif
+endef
+
+define Package/xray-core/install
+	$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
+
+	$(INSTALL_DIR) $(1)/usr/bin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
+ifneq ($(CONFIG_XRAY_CORE_PROVIDE_V2RAY_CORE),)
+	$(LN) xray $(1)/usr/bin/v2ray
+endif
+endef
+
+define Package/xray-geodata/install
+	$(INSTALL_DIR) $(1)/usr/share/xray/
+	$(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
+	$(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat
+endef
+
+$(eval $(call BuildPackage,xray-core))
+$(eval $(call BuildPackage,xray-geodata))

+ 0 - 142
xray/Makefile

@@ -1,142 +0,0 @@
-#
-# Copyright (C) 2019-2020 Xingwang Liao
-# Copyright (C) 2020-2021 Mattraks
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=xray
-PKG_VERSION:=1.2.4
-PKG_RELEASE:=1
-PKG_BUILD_DIR:=$(BUILD_DIR)/Xray-core-$(PKG_VERSION)
-
-PKG_SOURCE:=xray-core-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://codeload.github.com/XTLS/xray-core/tar.gz/v$(PKG_VERSION)?
-PKG_HASH:=25f6c9edec0ac1f98328943cd2bb760ac7b69107582f9d27e43559da39dc01ed
-
-PKG_LICENSE:=MPL
-PKG_LICENSE_FILES:=LICENSE
-
-PKG_CONFIG_DEPENDS:= \
-	CONFIG_XRAY_EXCLUDE_ASSETS \
-	CONFIG_XRAY_COMPRESS_GOPROXY \
-	CONFIG_XRAY_COMPRESS_UPX \
-	CONFIG_XRAY_COMPATIBILITY_MODE
-
-PKG_BUILD_DEPENDS:=golang/host
-PKG_BUILD_PARALLEL:=1
-PKG_USE_MIPS16:=0
-
-GO_PKG:=github.com/xtls/xray-core
-GO_PKG_LDFLAGS:=-s -w
-GO_PKG_LDFLAGS_X:= \
-	$(GO_PKG)/core.version=$(PKG_VERSION) \
-	$(GO_PKG)/core.codename=OpenWrt
-
-include $(INCLUDE_DIR)/package.mk
-include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
-
-define Package/$(PKG_NAME)
-  TITLE:=A platform for building proxies
-  SECTION:=net
-  CATEGORY:=Network
-  SUBMENU:=Project X
-  DEPENDS:=$(GO_ARCH_DEPENDS) +ca-certificates
-#  PROVIDES:=v2ray
-endef
-
-define Package/$(PKG_NAME)/description
-Project X originates from XTLS protocol, provides a set of network tools such as Xray-core and Xray-flutter.
-It secures your network connections and thus protects your privacy.
-
-  This package contains Xray, geoip.dat and geosite.dat.
-endef
-
-define Package/$(PKG_NAME)/config
-menu "Xray Configuration"
-	depends on PACKAGE_xray
-
-config XRAY_COMPRESS_GOPROXY
-	bool "Compiling with GOPROXY proxy"
-	default n
-
-config XRAY_EXCLUDE_ASSETS
-	bool "Exclude geoip.dat & geosite.dat"
-	default y
-
-config XRAY_COMPRESS_UPX
-	bool "Compress executable files with UPX"
-	default y
-
-config XRAY_COMPATIBILITY_MODE
-	bool "V2ray Compatibility mode(v2ray soft connection Xray)"
-	default n
-endmenu
-endef
-
-ifeq ($(CONFIG_XRAY_COMPRESS_GOPROXY),y)
-export GO111MODULE=on
-export GOPROXY=https://goproxy.io
-#export GOPROXY=https://mirrors.aliyun.com/goproxy/
-endif
-
-GEOIP_VER:=latest
-GEOIP_FILE:=geoip-$(GEOIP_VER).dat
-
-define Download/geoip.dat
-  URL:=https://github.com/v2fly/geoip/releases/$(GEOIP_VER)/download
-  URL_FILE:=geoip.dat
-  FILE:=$(GEOIP_FILE)
-  HASH:=skip
-endef
-
-GEOSITE_VER:=latest
-GEOSITE_FILE:=geosite-$(GEOSITE_VER).dat
-
-define Download/geosite.dat
-  URL:=https://github.com/v2fly/domain-list-community/releases/$(GEOSITE_VER)/download
-  URL_FILE:=dlc.dat
-  FILE:=$(GEOSITE_FILE)
-  HASH:=skip
-endef
-
-define Build/Prepare
-	$(call Build/Prepare/Default)
-ifneq ($(CONFIG_XRAY_EXCLUDE_ASSETS),y)
-	# move file to make sure download new file every build
-	mv -f $(DL_DIR)/$(GEOIP_FILE) $(PKG_BUILD_DIR)/geoip.dat
-	mv -f $(DL_DIR)/$(GEOSITE_FILE) $(PKG_BUILD_DIR)/geosite.dat
-endif
-endef
-
-define Build/Compile
-	$(eval GO_PKG_BUILD_PKG:=$(GO_PKG)/main)
-	$(call GoPackage/Build/Compile)
-	mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/xray
-ifeq ($(CONFIG_XRAY_COMPRESS_UPX),y)
-	$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/xray || true
-endif
-endef
-
-define Package/$(PKG_NAME)/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/xray $(1)/usr/bin
-ifeq ($(CONFIG_XRAY_COMPATIBILITY_MODE),y)
-	$(LN) xray $(1)/usr/bin/v2ray
-endif
-ifneq ($(CONFIG_XRAY_EXCLUDE_ASSETS),y)
-	$(INSTALL_DIR) $(1)/usr/share/xray
-	$(INSTALL_DATA) $(PKG_BUILD_DIR)/{geoip,geosite}.dat $(1)/usr/share/xray
-endif
-endef
-
-ifneq ($(CONFIG_XRAY_EXCLUDE_ASSETS),y)
-$(eval $(call Download,geoip.dat))
-$(eval $(call Download,geosite.dat))
-endif
-
-$(eval $(call GoBinPackage,$(PKG_NAME)))
-$(eval $(call BuildPackage,$(PKG_NAME)))