xray-core: add example configs
authorTianling Shen <[email protected]>
Wed, 3 Feb 2021 15:22:14 +0000 (23:22 +0800)
committerTianling Shen <[email protected]>
Wed, 3 Feb 2021 22:29:48 +0000 (06:29 +0800)
Thry're from v2fly/v2ray-core wikis, used as examples.

Signed-off-by: Tianling Shen <[email protected]>
net/xray-core/Makefile
net/xray-core/files/vpoint_socks_vmess.json [new file with mode: 0644]
net/xray-core/files/vpoint_vmess_freedom.json [new file with mode: 0644]

index 2fdbdafd705928ed04ed57d47f8eff09eb009cdd..f886985f49dda45e379c659f2195b3e4cbd347e2 100644 (file)
@@ -40,10 +40,18 @@ define Package/xray-core
   PROVIDES:=v2ray-core
 endef
 
+define Package/xray-example
+  $(call Package/xray/template)
+  TITLE+= (example configs)
+  DEPENDS:=xray-core
+  PKGARCH:=all
+endef
+
 define Package/xray-geodata
   $(call Package/xray/template)
   TITLE+= (geodata files)
   DEPENDS:=xray-core
+  PKGARCH:=all
 endef
 
 define Package/xray/description
@@ -55,6 +63,12 @@ define Package/xray-core/description
   $(call Package/xray/description)
 endef
 
+define Package/xray-example/description
+  $(call Package/xray/description)
+
+  This includes example configuration files for xray-core.
+endef
+
 define Package/xray-geodata/description
   $(call Package/xray/description)
 
@@ -97,6 +111,12 @@ define Package/xray-core/install
        $(LN) xray $(1)/usr/bin/v2ray
 endef
 
+define Package/xray-example/install
+       $(INSTALL_DIR) $(1)/etc/xray/
+       $(INSTALL_CONF) $(CURDIR)/files/vpoint_socks_vmess.json $(1)/etc/xray/
+       $(INSTALL_CONF) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/
+endef
+
 define Package/xray-geodata/install
        $(INSTALL_DIR) $(1)/usr/share/xray/
        $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
@@ -104,4 +124,5 @@ define Package/xray-geodata/install
 endef
 
 $(eval $(call BuildPackage,xray-core))
+$(eval $(call BuildPackage,xray-example))
 $(eval $(call BuildPackage,xray-geodata))
diff --git a/net/xray-core/files/vpoint_socks_vmess.json b/net/xray-core/files/vpoint_socks_vmess.json
new file mode 100644 (file)
index 0000000..789cd27
--- /dev/null
@@ -0,0 +1,25 @@
+{
+  "log": {
+    "loglevel": "warning"
+  },
+  "inbounds": [{
+    "port": 1080,
+    "listen": "127.0.0.1",
+    "protocol": "socks",
+    "settings": {
+      "auth": "noauth",
+      "udp": false,
+      "ip": "127.0.0.1"
+    }
+  }],
+  "outbounds": [{
+    "protocol": "freedom",
+    "settings": {},
+    "tag": "direct"
+  }],
+  "policy": {
+    "levels": {
+      "0": {"uplinkOnly": 0}
+    }
+  }
+}
diff --git a/net/xray-core/files/vpoint_vmess_freedom.json b/net/xray-core/files/vpoint_vmess_freedom.json
new file mode 100644 (file)
index 0000000..de51e9f
--- /dev/null
@@ -0,0 +1,32 @@
+{
+  "inbounds": [{
+    "port": 10086,
+    "protocol": "vmess",
+    "settings": {
+      "clients": [
+        {
+          "id": "23ad6b10-8d1a-40f7-8ad0-e3e35cd38297",
+          "level": 1,
+          "alterId": 64
+        }
+      ]
+    }
+  }],
+  "outbounds": [{
+    "protocol": "freedom",
+    "settings": {}
+  },{
+    "protocol": "blackhole",
+    "settings": {},
+    "tag": "blocked"
+  }],
+  "routing": {
+    "rules": [
+      {
+        "type": "field",
+        "ip": ["geoip:private"],
+        "outboundTag": "blocked"
+      }
+    ]
+  }
+}