support snap

This commit is contained in:
Dmitry Afanasiev 2024-09-13 09:13:55 +03:00
parent a2993ac68d
commit 1a4c441df9
2 changed files with 67 additions and 0 deletions

View File

@ -5,6 +5,7 @@
<!--ts-->
* [Binary](#binary)
* [Go](#go)
* [Snap](#snap)
<!--te-->
## Binary
@ -40,3 +41,32 @@ curl -fsSL https://raw.githubusercontent.com/xvzc/SpoofDPI/main/install.sh | bas
```bash
go install github.com/xvzc/SpoofDPI/cmd/spoofdpi@latest
```
## Snap
```bash
# Install from snapstore
snap install spoofdpi
# List services
snap services spoofdpi
# Enable and start spoofdpi.spoofdpi-daemon snap service
snap start --enable spoofdpi.spoofdpi-daemon
# Show generated systemd service status
systemctl status snap.spoofdpi.spoofdpi-daemon.service
# Override generated systemd service (configure startup options)
systemctl edit snap.spoofdpi.spoofdpi-daemon.service
## NOTE: you can pass args to spoofdpi:
## [Service]
## ExecStart=
## ExecStart=/usr/bin/snap run spoofdpi.spoofdpi-daemon --arg1 --arg2 .....
# Restart generated systemd service to apply changes
systemctl restart snap.spoofdpi.spoofdpi-daemon.service
# ... and show service status
systemctl status snap.spoofdpi.spoofdpi-daemon.service
```

37
snap/snapcraft.yaml Normal file
View File

@ -0,0 +1,37 @@
name: spoofdpi
adopt-info: spoofdpi
summary: A simple and fast anti-censorship tool written in Go
description: |
A simple and fast software designed to bypass Deep Packet Inspection.
base: core22
grade: stable
confinement: strict
architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf
- build-on: ppc64el
- build-on: riscv64
license: Apache-2.0
source-code: https://github.com/xvzc/SpoofDPI
apps:
spoofdpi-daemon:
command: spoofdpi
daemon: simple
install-mode: disable
plugs: [network, network-bind, network-control]
parts:
spoofdpi:
plugin: go
build-snaps: [go/latest/stable]
source: https://github.com/xvzc/SpoofDPI.git
source-type: git
override-pull: |
snapcraftctl pull
LAST_RELEASE=$(git tag --list | grep -P --regexp='v\d' | sort --version-sort | tail -1)
git checkout $LAST_RELEASE
snapcraftctl set-version ${LAST_RELEASE}+$(git rev-parse --short HEAD)
override-build: |
go build -o $SNAPCRAFT_PART_INSTALL/spoofdpi -ldflags '-w -s -extldflags "-static"' -tags timetzdata github.com/xvzc/SpoofDPI/cmd/spoofdpi