summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrumeet2022-01-17 23:29:49 -0800
committerTrumeet2022-01-17 23:29:49 -0800
commit3528b10aeeaaa45e35aa5a9bab6671e025beebaa (patch)
tree682648dc9f627a34e0edcac018fa35e43d5ce444
downloadaur-3528b10aeeaaa45e35aa5a9bab6671e025beebaa.tar.gz
First Commit
-rw-r--r--.SRCINFO21
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD63
-rw-r--r--rait-metrics.service10
-rw-r--r--rait.conf31
-rw-r--r--rait.service12
6 files changed, 142 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..57b910bb63c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = rait
+ pkgdesc = Redundant Array of Inexpensive Tunnels
+ pkgver = 4.3.0
+ pkgrel = 1
+ url = https://gitlab.com/NickCao/RAIT
+ arch = x86_64
+ license = custom
+ makedepends = go
+ depends = glibc
+ optdepends = babeld: Dynamic routing daemon
+ backup = etc/rait/rait.conf
+ source = https://gitlab.com/NickCao/RAIT/-/archive/v4.3.0/RAIT-v4.3.0.tar.gz
+ source = rait.service
+ source = rait-metrics.service
+ source = rait.conf
+ sha256sums = c5c45746ccd0fc4077980dd3bff36efb35003eb91935698e91d81ecf53865e6f
+ sha256sums = 7dce9ea0fbbea74320ae8ab55f92b59630b440e4a516beca03389114417d6d6f
+ sha256sums = db6854d47284aa1e902edbc01911d48311de82bef3d81fd1f0ca3f67dbea0cb4
+ sha256sums = 7f85c1f0f3979bce2072974b423964aeeb95f05176e0c06bf264b55ff51e53c3
+
+pkgname = rait
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..72e146003d5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.zst
+*.gz
+src/
+pkg/
+*.log
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..671a1b4aac0
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,63 @@
+# Maintainer: Yuuta Liang <yuuta@yuuta.moe>
+pkgname=rait
+pkgver=4.3.0
+pkgrel=1
+epoch=
+pkgdesc="Redundant Array of Inexpensive Tunnels"
+arch=(x86_64)
+url="https://gitlab.com/NickCao/RAIT"
+license=('custom')
+groups=()
+depends=(glibc)
+makedepends=(go)
+checkdepends=()
+optdepends=("babeld: Dynamic routing daemon")
+provides=()
+conflicts=()
+replaces=()
+backup=(etc/rait/rait.conf)
+options=()
+install=
+changelog=
+source=("https://gitlab.com/NickCao/RAIT/-/archive/v$pkgver/RAIT-v$pkgver.tar.gz"
+"rait.service"
+"rait-metrics.service"
+"rait.conf")
+noextract=()
+sha256sums=('c5c45746ccd0fc4077980dd3bff36efb35003eb91935698e91d81ecf53865e6f'
+ '7dce9ea0fbbea74320ae8ab55f92b59630b440e4a516beca03389114417d6d6f'
+ 'db6854d47284aa1e902edbc01911d48311de82bef3d81fd1f0ca3f67dbea0cb4'
+ '7f85c1f0f3979bce2072974b423964aeeb95f05176e0c06bf264b55ff51e53c3')
+validpgpkeys=()
+
+prepare() {
+ cd "RAIT-v$pkgver"
+}
+
+build() {
+ cd "RAIT-v$pkgver"
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+ export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
+ go build -o build ./cmd/...
+}
+
+check() {
+ cd "RAIT-v$pkgver"
+ go test ./...
+}
+
+package() {
+ cd "RAIT-v$pkgver"
+ install -Dm755 build "$pkgdir"/usr/bin/$pkgname
+ mkdir -p "$pkgdir"/usr/share/licenses/$pkgname/
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/license
+ cd ..
+ mkdir -p "$pkgdir"/usr/lib/systemd/system/
+ install -Dm644 rait.service "$pkgdir"/usr/lib/systemd/system/
+ install -Dm644 rait-metrics.service "$pkgdir"/usr/lib/systemd/system/
+ mkdir -p "$pkgdir"/etc/rait/
+ install -Dm600 rait.conf "$pkgdir"/etc/rait/
+}
diff --git a/rait-metrics.service b/rait-metrics.service
new file mode 100644
index 00000000000..be8cba10e1a
--- /dev/null
+++ b/rait-metrics.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Redundant Array of Inexpensive Tunnels (Prometrics Metrics)
+After=network.target network-online.target nss-lookup.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/rait metrics
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rait.conf b/rait.conf
new file mode 100644
index 00000000000..4574e37b476
--- /dev/null
+++ b/rait.conf
@@ -0,0 +1,31 @@
+registry = "https://example.com/rait" # url of rait registry
+operator_key = "EA8CQ4CAsvLuEnJvu8FQt0OIMh+NhlWIk0o12zNgekU=" # private key of node operator
+private_key = "KJJXmDtAXSrMGuIJVy/2eP65gXm1PTy7vCR/4O/vEEI=" # wireguard private key
+
+namespace = "rait" # netns to move interfaces into
+
+# both ifgroup and ifprefix should be unique across transports
+transport {
+ address_family = "ip4"
+ address = "8.8.8.8"
+ send_port = 50153
+ mtu = 1400
+ ifprefix = "rait4x"
+ ifgroup = 54
+ fwmark = 54
+ random_port = false
+}
+
+babeld {
+ enabled = true
+ socket_type = "unix"
+ socket_addr = "/run/babeld.ctl"
+ param = "type tunnel link-quality true"
+ footnote = "interface host type wireless"
+}
+
+remarks = {
+ prefix = "1.1.1.0/24"
+ name = "foo"
+ operator = "bar"
+}
diff --git a/rait.service b/rait.service
new file mode 100644
index 00000000000..49f55e17292
--- /dev/null
+++ b/rait.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Redundant Array of Inexpensive Tunnels
+After=network.target network-online.target nss-lookup.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/rait up
+ExecStop=/usr/bin/rait down
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target