summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo2023-06-13 20:46:46 +1000
committerLeo2023-06-13 20:46:46 +1000
commit2929f8cf05cac37886a5deebf45caf5ebaefaca4 (patch)
treed55d8cb5738609380d63fced29cef9af4b3448fb
downloadaur-2929f8cf05cac37886a5deebf45caf5ebaefaca4.tar.gz
Port tlsrouter to Arch Linux
-rw-r--r--.SRCINFO17
-rw-r--r--.gitignore19
-rw-r--r--PKGBUILD63
-rw-r--r--tlsrouter.sample.conf16
4 files changed, 115 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..f9e0eea7884f
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = tlsrouter-git
+ pkgdesc = Proxy TCP connections based on static rules, HTTP Host headers, and SNI server names
+ pkgver = r67.91f8614
+ pkgrel = 1
+ url = https://pkg.go.dev/inet.af/tcpproxy
+ arch = x86_64
+ license = Apache-2.0
+ makedepends = git
+ makedepends = go>=1.16
+ provides = tlsrouter-git
+ conflicts = tlsrouter-git
+ source = tcpproxy::git+https://github.com/inetaf/tcpproxy.git
+ source = tlsrouter.sample.conf
+ md5sums = SKIP
+ md5sums = SKIP
+
+pkgname = tlsrouter-git
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..42178ff1bcf8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+# source & package directories
+/src/*
+/pkg/*
+/tcpproxy/*
+
+# source tarballs
+*.tar
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.bz
+*.tar.bzip2
+
+
+# archlinux packages
+*.pkg.tar*
+
+# logs generated by makechrootpkg
+*.log
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..7712bbbce2f7
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,63 @@
+# Maintainer: Leo <i@setuid0.dev>
+pkgname=tlsrouter-git
+pkgver=r67.91f8614
+pkgrel=1
+pkgdesc="Proxy TCP connections based on static rules, HTTP Host headers, and SNI server names"
+arch=(x86_64)
+url="https://pkg.go.dev/inet.af/tcpproxy"
+license=('Apache-2.0')
+groups=()
+depends=()
+makedepends=('git' 'go>=1.16')
+provides=("${pkgname%-VCS}")
+conflicts=("${pkgname%-VCS}")
+replaces=()
+backup=()
+options=()
+install=
+source=(
+ 'tcpproxy::git+https://github.com/inetaf/tcpproxy.git'
+ 'tlsrouter.sample.conf'
+)
+noextract=()
+md5sums=('SKIP' 'SKIP')
+
+pkgver() {
+ cd "$srcdir/tcpproxy"
+# Git, no tags available
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ export GOPATH="$srcdir/gopath"
+ cd "$srcdir/tcpproxy"
+ go mod download
+ go mod verify
+}
+
+build() {
+ export GOPATH="$srcdir/gopath"
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+
+ cd "$srcdir/tcpproxy"
+
+ CGO_ENABLED=0 go build \
+ -trimpath \
+ -o ./tlsrouter \
+ ./cmd/tlsrouter/main.go \
+ ./cmd/tlsrouter/config.go \
+ ./cmd/tlsrouter/sni.go
+}
+
+check() {
+ :
+}
+
+package() {
+ install -Dt "$pkgdir/usr/bin/" -m755 "$srcdir/tcpproxy/tlsrouter"
+ install -Dt "$pkgdir/usr/share/tlsrouter/" -m644 "$srcdir/tlsrouter.sample.conf"
+ install -Dt "$pkgdir/usr/lib/systemd/system/" -m644 "$srcdir/tcpproxy/systemd/tlsrouter.service"
+}
diff --git a/tlsrouter.sample.conf b/tlsrouter.sample.conf
new file mode 100644
index 000000000000..bdc1bcaad600
--- /dev/null
+++ b/tlsrouter.sample.conf
@@ -0,0 +1,16 @@
+# Basic hostname -> backend mapping
+go.universe.tf localhost:1234
+
+# DNS wildcards are understood as well.
+*.go.universe.tf 1.2.3.4:8080
+
+# DNS wildcards can go anywhere in name.
+google.* 10.20.30.40:443
+
+# RE2 regexes are also available
+/(alpha|beta|gamma)\.mon(itoring)?\.dave\.tf/ 100.200.100.200:443
+
+# If your backend supports HAProxy's PROXY protocol, you can enable
+# it to receive the real client ip:port.
+
+fancy.backend 2.3.4.5:443 PROXY \ No newline at end of file