Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support snap #244

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions _docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!--ts-->
* [Binary](#binary)
* [Go](#go)
* [Snap](#snap)
<!--te-->

## Binary
Expand Down Expand Up @@ -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 changes: 37 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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