diff options
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | PKGBUILD | 55 | ||||
-rw-r--r-- | config.json | 143 | ||||
-rw-r--r-- | vpoint_socks_vmess.json | 25 | ||||
-rw-r--r-- | vpoint_vmess_freedom.json | 32 | ||||
-rw-r--r-- | xray.service | 16 | ||||
-rw-r--r-- | xray@.service | 17 |
7 files changed, 316 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..c0ed724f7b67 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = xray + pkgdesc = Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration. + pkgver = 1.0.0 + pkgrel = 1 + url = https://github.com/XTLS/Xray-core + arch = any + license = MPLv2 + makedepends = go + makedepends = git + depends = glibc + depends = v2ray-domain-list-community + depends = v2ray-geoip + backup = etc/xray/config.json + source = xray-1.0.0.tar.gz::https://github.com/XTLS/Xray-core/archive/v1.0.0.tar.gz + source = config.json + source = vpoint_socks_vmess.json + source = vpoint_vmess_freedom.json + source = xray.service + source = xray@.service + sha512sums = 03c6337ca13e135f7cdaef978bb526c846cd83ff30036764aacaecbf22a9ad79dc661de6f5fd699fbf22fac6833a4aeb5870941c82aee0d74fc60641f858460e + sha512sums = 2000211cbf987adaee7f278cc8cb23268965caab3bc46401f9324f2beaad95bec11012f5f4500f1016f4b75f097f3ac96cc5be2da7a6df0261582b3f23b3d78d + sha512sums = 9914fd3da02511b716951e521ca22006a6e8ad66e64d32cc7dd7dc3544a754174b37e35df6108ca217130f02763265d74f8bc56c4e52b262bdd48dcdb5310eb5 + sha512sums = 532f66fe19196de0cc43df1812d6f32cbca7bbcacaa0cd4141bd80b3121b17eb8b23e0464765cf05a97b11e0213fb688eade83e393e36b3e7ebded6f0925de97 + sha512sums = 1d31e11c3a11090ee2616adfcf77a4a1013793c8f63a41e5293d07e889e34f85223b9f5a0791b649f22ecc5e18e12182b5b074e61aa36f5cd6de523f3c64f95d + sha512sums = 6582aa9bf988acb2660a7172282768c217ad8335a55ccee916d7786c227bc62cc973d7d6d3b5632260c69eec98c15804c2b52cdd91c5f395d3a0fe36519586b4 + +pkgname = xray + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a629007baa49 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,55 @@ +# Maintainer: AkinoKaede <autmaple@protonmail.com> +#Special thanks: Felix Yan <felixonmars@archlinux.org> +# Contributor: pandada8 <pandada8@gmail.com> + +pkgname=xray +pkgver=1.0.0 +pkgrel=1 +pkgdesc="Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration. " +arch=('any') +url="https://github.com/XTLS/Xray-core" +license=('MPLv2') +depends=('glibc' 'v2ray-domain-list-community' 'v2ray-geoip') +makedepends=('go' 'git') +backup=(etc/xray/config.json) +source=( + "$pkgname-$pkgver.tar.gz::https://github.com/XTLS/Xray-core/archive/v$pkgver.tar.gz" + "config.json" + "vpoint_socks_vmess.json" + "vpoint_vmess_freedom.json" + "xray.service" + "xray@.service" +) +sha512sums=( + '03c6337ca13e135f7cdaef978bb526c846cd83ff30036764aacaecbf22a9ad79dc661de6f5fd699fbf22fac6833a4aeb5870941c82aee0d74fc60641f858460e' + '2000211cbf987adaee7f278cc8cb23268965caab3bc46401f9324f2beaad95bec11012f5f4500f1016f4b75f097f3ac96cc5be2da7a6df0261582b3f23b3d78d' + '9914fd3da02511b716951e521ca22006a6e8ad66e64d32cc7dd7dc3544a754174b37e35df6108ca217130f02763265d74f8bc56c4e52b262bdd48dcdb5310eb5' + '532f66fe19196de0cc43df1812d6f32cbca7bbcacaa0cd4141bd80b3121b17eb8b23e0464765cf05a97b11e0213fb688eade83e393e36b3e7ebded6f0925de97' + '1d31e11c3a11090ee2616adfcf77a4a1013793c8f63a41e5293d07e889e34f85223b9f5a0791b649f22ecc5e18e12182b5b074e61aa36f5cd6de523f3c64f95d' + '6582aa9bf988acb2660a7172282768c217ad8335a55ccee916d7786c227bc62cc973d7d6d3b5632260c69eec98c15804c2b52cdd91c5f395d3a0fe36519586b4' +) + +build() { + cd $startdir/src/Xray-core-$pkgver + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external" + export CGO_LDFLAGS="${LDFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CPPFLAGS="${CPPFLAGS}" + go build -o xray ./main +} + +check() { + cd $startdir/src/Xray-core-$pkgver + go test -p 1 -tags json -v -timeout 30m github.com/xtls/xray-core/v1/core/... +} + +package() { + cd $startdir + install -Dm644 xray.service "$pkgdir"/usr/lib/systemd/system/xray.service + install -Dm644 xray@.service "$pkgdir"/usr/lib/systemd/system/xray@.service + install -Dm644 *.json -t "$pkgdir"/etc/xray/ + + cd $startdir/src/Xray-core-$pkgver + install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/xray/LICENSE + install -Dm755 xray -t "$pkgdir"/usr/bin/ +} diff --git a/config.json b/config.json new file mode 100644 index 000000000000..4506bac71993 --- /dev/null +++ b/config.json @@ -0,0 +1,143 @@ +// Config file of Xray. This file follows standard JSON format, with comments support. +// Uncomment entries below to satisfy your needs. Also read our manual for more detail at +{ + "log": { + // By default, Xray writes access log to stdout. + // "access": "/path/to/access/log/file", + + // By default, Xray write error log to stdout. + // "error": "/path/to/error/log/file", + + // Log level, one of "debug", "info", "warning", "error", "none" + "loglevel": "warning" + }, + // List of inbound proxy configurations. + "inbounds": [{ + // Port to listen on. You may need root access if the value is less than 1024. + "port": 1080, + + // IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces. + "listen": "127.0.0.1", + + // Tag of the inbound proxy. May be used for routing. + "tag": "socks-inbound", + + // Protocol name of inbound proxy. + "protocol": "socks", + + // Settings of the protocol. Varies based on protocol. + "settings": { + "auth": "noauth", + "udp": false, + "ip": "127.0.0.1" + }, + + // Enable sniffing on TCP connection. + "sniffing": { + "enabled": true, + // Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS. + "destOverride": ["http", "tls"] + } + }], + // List of outbound proxy configurations. + "outbounds": [{ + // Protocol name of the outbound proxy. + "protocol": "freedom", + + // Settings of the protocol. Varies based on protocol. + "settings": {}, + + // Tag of the outbound. May be used for routing. + "tag": "direct" + },{ + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }], + + // Transport is for global transport settings. If you have multiple transports with same settings + // (say mKCP), you may put it here, instead of in each individual inbound/outbounds. + //"transport": {}, + + // Routing controls how traffic from inbounds are sent to outbounds. + "routing": { + "domainStrategy": "IPOnDemand", + "rules":[ + { + // Blocks access to private IPs. Remove this if you want to access your router. + "type": "field", + "ip": ["geoip:private"], + "outboundTag": "blocked" + }, + { + // Blocks major ads. + "type": "field", + "domain": ["geosite:category-ads"], + "outboundTag": "blocked" + } + ] + }, + + // Dns settings for domain resolution. + "dns": { + // Static hosts, similar to hosts file. + "hosts": { + // Match v2ray.com to another domain on CloudFlare. This domain will be used when querying IPs for v2ray.com. + "domain:v2ray.com": "www.vicemc.net", + + // The following settings help to eliminate DNS poisoning in mainland China. + // It is safe to comment these out if this is not the case for you. + "domain:github.io": "pages.github.com", + "domain:wikipedia.org": "www.wikimedia.org", + "domain:shadowsocks.org": "electronicsrealm.com" + }, + "servers": [ + "1.1.1.1", + { + "address": "114.114.114.114", + "port": 53, + // List of domains that use this DNS first. + "domains": [ + "geosite:cn" + ] + }, + "8.8.8.8", + "localhost" + ] + }, + + // Policy controls some internal behavior of how Xray handles connections. + // It may be on connection level by user levels in 'levels', or global settings in 'system.' + "policy": { + // Connection policys by user levels + "levels": { + "0": { + "uplinkOnly": 0, + "downlinkOnly": 0 + } + }, + "system": { + "statsInboundUplink": false, + "statsInboundDownlink": false, + "statsOutboundUplink": false, + "statsOutboundDownlink": false + } + }, + + // Stats enables internal stats counter. + // This setting can be used together with Policy and Api. + //"stats":{}, + + // Api enables gRPC APIs for external programs to communicate with Xray instance. + //"api": { + //"tag": "api", + //"services": [ + // "HandlerService", + // "LoggerService", + // "StatsService" + //] + //}, + + // You may add other entries to the configuration, but they will not be recognized by Xray. + "other": {} +} diff --git a/vpoint_socks_vmess.json b/vpoint_socks_vmess.json new file mode 100644 index 000000000000..789cd270af2a --- /dev/null +++ b/vpoint_socks_vmess.json @@ -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/vpoint_vmess_freedom.json b/vpoint_vmess_freedom.json new file mode 100644 index 000000000000..de51e9f240fc --- /dev/null +++ b/vpoint_vmess_freedom.json @@ -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" + } + ] + } +} diff --git a/xray.service b/xray.service new file mode 100644 index 000000000000..77889293c647 --- /dev/null +++ b/xray.service @@ -0,0 +1,16 @@ +[Unit] +Description=Xray Service +Documentation=https://github.com/xtls +After=network.target nss-lookup.target + +[Service] +User=nobody +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +NoNewPrivileges=true +ExecStart=/usr/bin/xray run -config /etc/xray/config.json +Restart=on-failure +RestartPreventExitStatus=23 + +[Install] +WantedBy=multi-user.target diff --git a/xray@.service b/xray@.service new file mode 100644 index 000000000000..c7563486d112 --- /dev/null +++ b/xray@.service @@ -0,0 +1,17 @@ +[Unit] +Description=Xray Service +Documentation=https://github.com/xtls +After=network.target nss-lookup.target + +[Service] +User=nobody +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +NoNewPrivileges=true +ExecStart=/usr/bin/xray run -config /etc/xray/%i.json +Restart=on-failure +RestartPreventExitStatus=23 + +[Install] +WantedBy=multi-user.target + |