summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLittleYe2332022-01-14 15:07:04 +0000
committerLittleYe2332022-12-09 00:58:20 +0800
commitb28c1e70427a1187d674d27556c5b30db9177d97 (patch)
treebd092d64239c92a51d6e39c8e9a1537582e6c5a5
downloadaur-tun2socks-bin.tar.gz
build: fork from tun2socks 2.4.1
This commit is forked from commit 4d8ad8ae6771cea93da74159edd0447abe726fed of tun2socks.git in AUR. Also it adds a service unit file and a YAML configuration file to the package.
-rw-r--r--.SRCINFO25
-rw-r--r--PKGBUILD36
-rw-r--r--config.yaml30
-rw-r--r--tun2socks.service12
4 files changed, 103 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..9ff5a02a8216
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = tun2socks-bin
+ pkgdesc = tun2socks - powered by gVisor TCP/IP stack
+ pkgver = 2.4.1
+ pkgrel = 1
+ url = https://github.com/xjasonlyu/tun2socks
+ arch = x86_64
+ arch = i686
+ arch = armv7h
+ arch = aarch64
+ license = GPL3
+ conflicts = tun2socks
+ source = config.yaml
+ source = tun2socks.service
+ sha256sums = 33e1d59671dd21199b241313658d5ec23ef65c79586d1108d7237362458f5329
+ sha256sums = 877cd2b80c5c4065b5828fa470754e5c812110ffbf545c9471f63b651a2808c7
+ source_x86_64 = tun2socks-linux-amd64-2.4.1.zip::https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-linux-amd64.zip
+ sha256sums_x86_64 = 4e025470453cc0b4c72b384b1441ecbeba1cf3b2ae98837ba630aa5102d1b6d0
+ source_i686 = tun2socks-linux-386-2.4.1.zip::https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-linux-386.zip
+ sha256sums_i686 = ac208550f9e5497ef437b924f8e284359c7cdff98f2d1924d212821ae544940d
+ source_armv7h = tun2socks-linux-armv7-2.4.1.zip::https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-linux-armv7.zip
+ sha256sums_armv7h = 1182b15d8277fa6ea660c74b71599cb2417bdc28c889215514f414978a26a9d3
+ source_aarch64 = tun2socks-linux-arm64-2.4.1.zip::https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-linux-arm64.zip
+ sha256sums_aarch64 = 74200b1f738a038ff90ec70377feb61c978487c71b2a9468d827c188fc33a900
+
+pkgname = tun2socks-bin
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..66e8ef19af9e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,36 @@
+# Maintainer: LittleYe233 <littleye233 at gmail dot com>
+# Contributor: BigmenPixel <bigmen dot pixel at tuta dot io>
+
+pkgname=tun2socks-bin
+_pkgname=tun2socks
+pkgver=2.4.1
+pkgrel=1
+pkgdesc="tun2socks - powered by gVisor TCP/IP stack"
+arch=('x86_64' 'i686' 'armv7h' 'aarch64')
+url="https://github.com/xjasonlyu/tun2socks"
+license=('GPL3')
+makedepends=()
+conflicts=("tun2socks")
+
+source=("config.yaml" "${_pkgname}.service")
+source_x86_64=("${_pkgname}-linux-amd64-${pkgver}.zip::${url}/releases/download/v${pkgver}/${_pkgname}-linux-amd64.zip")
+source_i686=("${_pkgname}-linux-386-${pkgver}.zip::${url}/releases/download/v${pkgver}/${_pkgname}-linux-386.zip")
+source_armv7h=("${_pkgname}-linux-armv7-${pkgver}.zip::${url}/releases/download/v${pkgver}/${_pkgname}-linux-armv7.zip")
+source_aarch64=("${_pkgname}-linux-arm64-${pkgver}.zip::${url}/releases/download/v${pkgver}/${_pkgname}-linux-arm64.zip")
+
+sha256sums=("33e1d59671dd21199b241313658d5ec23ef65c79586d1108d7237362458f5329"
+ "877cd2b80c5c4065b5828fa470754e5c812110ffbf545c9471f63b651a2808c7")
+sha256sums_x86_64=("4e025470453cc0b4c72b384b1441ecbeba1cf3b2ae98837ba630aa5102d1b6d0")
+sha256sums_i686=("ac208550f9e5497ef437b924f8e284359c7cdff98f2d1924d212821ae544940d")
+sha256sums_armv7h=("1182b15d8277fa6ea660c74b71599cb2417bdc28c889215514f414978a26a9d3")
+sha256sums_aarch64=("74200b1f738a038ff90ec70377feb61c978487c71b2a9468d827c188fc33a900")
+
+package() {
+ declare -A ARCH_MAP
+ ARCH_MAP=( [x86_64]='amd64' [i686]='386' [armv7h]='armv7' [aarch64]='arm64' )
+ _execname="${_pkgname}-linux-${ARCH_MAP[${CARCH}]}"
+
+ install -Dm755 "${srcdir}/${_execname}" "${pkgdir}"/usr/bin/"${_pkgname}"
+ install -Dm644 "${srcdir}"/config.yaml -t "${pkgdir}"/etc/tun2socks
+ install -Dm644 "${srcdir}/${_pkgname}".service -t "${pkgdir}"/usr/lib/systemd/system
+}
diff --git a/config.yaml b/config.yaml
new file mode 100644
index 000000000000..2d4bfce50919
--- /dev/null
+++ b/config.yaml
@@ -0,0 +1,30 @@
+# An example configuration copied and slightly modified from the official wiki.
+#
+# Maybe you need to modify `proxy`, `device` and `interface` config items to fit
+# with your own network environment.
+#
+# See https://github.com/xjasonlyu/tun2socks/wiki/Configuration.
+
+# debug / info / warning / error / silent
+loglevel: warning
+
+# URL format: [protocol://]host[:port]
+proxy: direct://
+
+# URL format: [driver://]name
+device: tun://tun0
+
+# Maximum transmission unit for each packet
+mtu: 1500
+
+# Network interface to bind, Linux/macOS only
+interface: eth0
+
+# Timeout for each UDP session, default value: 60 seconds
+udp-timeout: 60s
+
+# SO_MARK socket option, Linux only
+fwmark: 0
+
+# RESTful API server URL
+restapi: http://127.0.0.1:9000
diff --git a/tun2socks.service b/tun2socks.service
new file mode 100644
index 000000000000..1b32dcaa81b8
--- /dev/null
+++ b/tun2socks.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=tun2socks - powered by gVisor TCP/IP stack
+After=network.target
+
+[Service]
+Type=simple
+User=root
+Restart=on-failure
+ExecStart=/usr/bin/tun2socks -config /etc/tun2socks/config.yaml
+
+[Install]
+WantedBy=multi-user.target